Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4ad30ea67c8d320da890d364bd50cbc88a0be87e
      
https://github.com/WebKit/WebKit/commit/4ad30ea67c8d320da890d364bd50cbc88a0be87e
  Author: Dan Hecht <[email protected]>
  Date:   2025-12-17 (Wed, 17 Dec 2025)

  Changed paths:
    M Source/JavaScriptCore/wasm/WasmOMGIRGenerator.cpp

  Log Message:
  -----------
  [JSC] Wasm: OMG B3 IR should not have a B3::Variable for every wasm expression
https://bugs.webkit.org/show_bug.cgi?id=304352
rdar://155818669

Reviewed by Keith Miller and Yusuke Suzuki.

Currently, OMGIRGenerator creates a B3::Variable and corresponding
Set and Get B3::Values for every wasm stack expression. It does this
so that if a catch handler entrypoint or loop OSR entrypoint is
needed, these alternate entry points have a way to modify the wasm
state (to unwind the stack or OSR enter). Inserting Phis for this
is difficult in a single pass, and this way, we leverage the existing
fixSSA pass to convert the Get/Set/Variables into Phis.

However, this pessimizes the usual case and is wasteful since most
wasm expressions that occur in a function are not going to be on the
wasm stack when the parser encounters Try/TryTable/Loop. So doing this
creates a lot of extraneous work for fixSSA as well as a bunch of
unnecessary allocations of these Variables and Values, only to throw
them away shortly. Also, it makes the generated IR convoluted and
more difficult to read.

Instead, let's optimistically generate B3::Value for wasm expressions,
and "materialize" Values into Variables only when necessary
for Values that are on the wasm stack when the parser encounters
Try/TryTable/Loop. To do this, we go back and rewrite the code a bit to
insert Sets at the points where these Values were generated. That way,
we still leverage fixSSA for Phi placement for these alternate
entrypoints, yet the vast majority of wasm stack expressions can be
SSA B3::Values from the start.

Testing: covered by existing wasm tests
Canonical link: https://commits.webkit.org/304637@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to