Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 83c1c1073f0f9d01b9bb573d3cf50aee14314d5a
      
https://github.com/WebKit/WebKit/commit/83c1c1073f0f9d01b9bb573d3cf50aee14314d5a
  Author: Asumu Takikawa <as...@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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to