[webkit-changes] [WebKit/WebKit] c95070: [WGSL] Only visit functions and structures once

Tadeu Zagallo noreply at github.com
Tue Aug 15 03:53:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c9507058e6995c9f173d0552bc12e7749a2ada3f
      https://github.com/WebKit/WebKit/commit/c9507058e6995c9f173d0552bc12e7749a2ada3f
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M Source/WebGPU/WGSL/MangleNames.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/TypeStore.cpp
    M Source/WebGPU/WGSL/TypeStore.h

  Log Message:
  -----------
  [WGSL] Only visit functions and structures once
https://bugs.webkit.org/show_bug.cgi?id=260144
rdar://113854125

Reviewed by Dan Glastonbury.

Originally, the type checker and name mangling pass did two passes over global
declarations. That was necessary since declarations can refer to other declarations
that only appear later in the program. However, in 266862 at main we introduced a new
pass that sorts all declarations, guaranteeing that by the time we visit a given
declaration, any other declaration it depends on will have already been visited.
This allows simplifying the code, and doing a single pass over all declarations.

* Source/WebGPU/WGSL/MangleNames.cpp:
(WGSL::NameManglerVisitor::run):
(WGSL::NameManglerVisitor::visit):
(WGSL::NameManglerVisitor::visitFunctionBody): Deleted.
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::check):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::visitStructMembers): Deleted.
(WGSL::TypeChecker::visitFunctionBody): Deleted.
* Source/WebGPU/WGSL/TypeStore.cpp:
(WGSL::TypeStore::structType):
* Source/WebGPU/WGSL/TypeStore.h:
(WGSL::TypeStore::structType):

Canonical link: https://commits.webkit.org/266900@main




More information about the webkit-changes mailing list