[webkit-changes] [WebKit/WebKit] 8f0383: [WGSL] Clean up AST nodes created during compilation

Tadeu Zagallo noreply at github.com
Fri May 26 02:05:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8f038359050c7ede97ac743ac058b77b64466ada
      https://github.com/WebKit/WebKit/commit/8f038359050c7ede97ac743ac058b77b64466ada
  Author: Tadeu Zagallo <tzagallo at apple.com>
  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




More information about the webkit-changes mailing list