[webkit-changes] [WebKit/WebKit] a8e15b: [WGSL] Compiler passes have incorrect scoping
Tadeu Zagallo
noreply at github.com
Fri Feb 2 08:39:32 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a8e15be46cf742a7fd2a0067bbf6405ddee5e7b9
https://github.com/WebKit/WebKit/commit/a8e15be46cf742a7fd2a0067bbf6405ddee5e7b9
Author: Tadeu Zagallo <tzagallo at apple.com>
Date: 2024-02-02 (Fri, 02 Feb 2024)
Changed paths:
A Source/WebGPU/WGSL/AST/ASTScopedVisitor.h
A Source/WebGPU/WGSL/AST/ASTScopedVisitorInlines.h
M Source/WebGPU/WGSL/AST/ASTVisitor.cpp
M Source/WebGPU/WGSL/GlobalSorting.cpp
M Source/WebGPU/WGSL/MangleNames.cpp
M Source/WebGPU/WGSL/PointerRewriter.cpp
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
Log Message:
-----------
[WGSL] Compiler passes have incorrect scoping
https://bugs.webkit.org/show_bug.cgi?id=268490
rdar://121527200
Reviewed by Mike Wyrzykowski.
Not all classes that relied on the ContextProvider to track values while visiting
the AST provided overrides for all the nodes that had introduce a scope. That
resulted in incorrect scope tracking (e.g. the variables introduced in a for loop
might leak or similar). Move some of that logic into a new helper class, ScopedVisitor,
and updated all the subclasses of ContextProvider to use it instead of the base Visitor.
* Source/WebGPU/WGSL/AST/ASTScopedVisitor.h: Added.
* Source/WebGPU/WGSL/AST/ASTScopedVisitorInlines.h: Added.
(WGSL::AST::ScopedVisitor<T>::visit):
* Source/WebGPU/WGSL/AST/ASTVisitor.cpp:
(WGSL::AST::Visitor::visit):
* Source/WebGPU/WGSL/GlobalSorting.cpp:
(WGSL::GraphBuilder::GraphBuilder::visit):
(WGSL::GraphBuilder::visit): Deleted.
(WGSL::GraphBuilder::GraphBuilder): Deleted.
(WGSL::GraphBuilder::introduceVariable): Deleted.
(WGSL::GraphBuilder::readVariable const): Deleted.
(WGSL::reorder): Deleted.
(WGSL::reorderGlobals): Deleted.
* Source/WebGPU/WGSL/MangleNames.cpp:
(WGSL::NameManglerVisitor::run):
(WGSL::NameManglerVisitor::visit):
(WGSL::NameManglerVisitor::visitVariableDeclaration):
* Source/WebGPU/WGSL/PointerRewriter.cpp:
(WGSL::PointerRewriter::PointerRewriter):
(WGSL::PointerRewriter::run):
(WGSL::PointerRewriter::rewrite):
(WGSL::PointerRewriter::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::bindingKindToString):
(WGSL::TypeChecker::check):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::visitAttributes):
(WGSL::TypeChecker::infer):
(WGSL::TypeChecker::resolve):
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
Canonical link: https://commits.webkit.org/273993@main
More information about the webkit-changes
mailing list