Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8f038359050c7ede97ac743ac058b77b64466ada
      
https://github.com/WebKit/WebKit/commit/8f038359050c7ede97ac743ac058b77b64466ada
  Author: Tadeu Zagallo <[email protected]>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTBuilder.cpp
    M Source/WebGPU/WGSL/AST/ASTBuilder.h
    M Source/WebGPU/WGSL/WGSL.cpp
    M Source/WebGPU/WGSL/WGSLShaderModule.h

  Log Message:
  -----------
  [WGSL] Clean up AST nodes created during compilation
https://bugs.webkit.org/show_bug.cgi?id=257328
rdar://109833858

Reviewed by Mike Wyrzykowski.

We allocate new nodes during compilation, and since we can compile the
same module multiple times, that could lead to unbounded memory growth.
In order to fix that, we save the state of the allocator before we start
a new compilation and erase all objects allocate after that point once
we are done compiling. That is safe since we already revert all AST
modifications in a similar manner.

* Source/WebGPU/WGSL/AST/ASTBuilder.cpp:
(WGSL::AST::Builder::saveCurrentState):
(WGSL::AST::Builder::restore):
* Source/WebGPU/WGSL/AST/ASTBuilder.h:
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::prepareImpl):
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::Compilation::Compilation):
(WGSL::ShaderModule::Compilation::~Compilation):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to