[webkit-changes] [WebKit/WebKit] 83c1c1: [WASM-Function-References] Add support for local i...

Asumu Takikawa noreply at github.com
Fri Aug 25 17:54:32 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 83c1c1073f0f9d01b9bb573d3cf50aee14314d5a
      https://github.com/WebKit/WebKit/commit/83c1c1073f0f9d01b9bb573d3cf50aee14314d5a
  Author: Asumu Takikawa <asumu at igalia.com>
  Date:   2023-08-25 (Fri, 25 Aug 2023)

  Changed paths:
    A JSTests/wasm/function-references-spec-tests/local_init.wast.js
    A JSTests/wasm/function-references/local_init.js
    M JSTests/wasm/function-references/ref_types.js
    M Source/JavaScriptCore/wasm/WasmFunctionParser.h

  Log Message:
  -----------
  [WASM-Function-References] Add support for local initialization tracking
https://bugs.webkit.org/show_bug.cgi?id=247396

Reviewed by Justin Michaud.

Add local initialization tracking as added by the typed function references
proposal. This allows the use of non-defaultable locals (e.g., with types like
(ref extern) that are non-nullable). Non-defaultable locals can only be read
with local.get after an initialization by, e.g., local.set.

To track the local state, an initialization stack (max height is the number of
non-defaultable locals) is used that tracks initialized non-defaultable locals.
The stack is popped to a previous state on exit from a block.  A bitvector is
used to map local indices to initialization state, to facilitate quick lookups.

* JSTests/wasm/function-references-spec-tests/local_init.wast.js: Added.
* JSTests/wasm/function-references/local_init.js: Added.
(module):
(async testLocalInit):
* JSTests/wasm/function-references/ref_types.js:
(async testNonNullRefTypeLocal):
* Source/JavaScriptCore/wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser::pushLocalInitialized):
(JSC::Wasm::FunctionParser::getLocalInitStackHeight const):
(JSC::Wasm::FunctionParser::resetLocalInitStackToHeight):
(JSC::Wasm::FunctionParser::localIsInitialized):
(JSC::Wasm::FunctionParser<Context>::parse):
(JSC::Wasm::FunctionParser<Context>::parseBody):
(JSC::Wasm::FunctionParser<Context>::checkLocalInitialized):
(JSC::Wasm::FunctionParser<Context>::parseExpression):
(JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression):

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




More information about the webkit-changes mailing list