[webkit-changes] [WebKit/WebKit] dda771: [Wasm-GC] Implement basic support in tables for GC...

Asumu Takikawa noreply at github.com
Fri Mar 31 18:57:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dda771352e63f963e07d78df75adfbc1826598c8
      https://github.com/WebKit/WebKit/commit/dda771352e63f963e07d78df75adfbc1826598c8
  Author: Asumu Takikawa <asumu at igalia.com>
  Date:   2023-03-31 (Fri, 31 Mar 2023)

  Changed paths:
    A JSTests/wasm/function-references/table.js
    M JSTests/wasm/gc-spec-harness.js
    A JSTests/wasm/gc-spec-tests/ref_cast.wast.js
    M JSTests/wasm/gc/arrays.js
    M JSTests/wasm/gc/i31.js
    M JSTests/wasm/gc/structs.js
    M JSTests/wasm/js-api/table.js
    M Source/JavaScriptCore/wasm/WasmFormat.h
    M Source/JavaScriptCore/wasm/WasmOperationsInlines.h
    M Source/JavaScriptCore/wasm/WasmSectionParser.cpp
    M Source/JavaScriptCore/wasm/WasmSlowPaths.cpp
    M Source/JavaScriptCore/wasm/WasmTable.cpp
    M Source/JavaScriptCore/wasm/WasmTable.h
    M Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp
    M Source/JavaScriptCore/wasm/WasmTypeDefinition.h
    M Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp

  Log Message:
  -----------
  [Wasm-GC] Implement basic support in tables for GC types
https://bugs.webkit.org/show_bug.cgi?id=251041

Reviewed by Justin Michaud.

Updates Wasm table type parsing so that defaultable ref types other than
externref and funcref are allowed. Also stores the Wasm element type in
TableInformation, as the element type cannot be deduced from other
information when other ref types are allowed.

The internal implementations of the ref.cast and extern.internalize
operations are also moved so that they can be used from table prototype
methods.

This also implements the part of the JS API for tables, which specifies
that when JS tries to store a value into a table with a GC type, it is
internalized and then cast to the appropriate type.

The typed function reference proposal also extends tables to allow
non-defaultable ref types as long as a table initializer expression is
provided. This is not yet supported in this patch.

* JSTests/wasm/function-references/table.js: Added.
(module):
(async testTypedFuncrefTable):
* JSTests/wasm/gc-spec-harness.js:
* JSTests/wasm/gc-spec-tests/ref_cast.wast.js: Added.
* JSTests/wasm/gc/arrays.js:
* JSTests/wasm/gc/i31.js:
* JSTests/wasm/gc/structs.js:
* JSTests/wasm/js-api/table.js:
(assert.throws):
* Source/JavaScriptCore/wasm/WasmFormat.h:
(JSC::Wasm::internalizeExternref):
(JSC::Wasm::TableInformation::TableInformation):
(JSC::Wasm::TableInformation::wasmType const):
* Source/JavaScriptCore/wasm/WasmOperationsInlines.h:
(JSC::Wasm::refCast):
(JSC::Wasm::externInternalize):
* Source/JavaScriptCore/wasm/WasmSectionParser.cpp:
(JSC::Wasm::SectionParser::parseTableHelper):
* Source/JavaScriptCore/wasm/WasmSlowPaths.cpp:
(JSC::LLInt::WASM_SLOW_PATH_DECL):
* Source/JavaScriptCore/wasm/WasmTable.cpp:
(JSC::Wasm::Table::Table):
(JSC::Wasm::Table::tryCreate):
(JSC::Wasm::ExternRefTable::ExternRefTable):
(JSC::Wasm::FuncRefTable::FuncRefTable):
(JSC::Wasm::FuncRefTable::createFixedSized):
(JSC::Wasm::Table::wasmType const): Deleted.
* Source/JavaScriptCore/wasm/WasmTable.h:
(JSC::Wasm::Table::wasmType const):
* Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp:
(JSC::Wasm::TypeInformation::castReference):
* Source/JavaScriptCore/wasm/WasmTypeDefinition.h:
* Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::initializeExports):
* Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

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




More information about the webkit-changes mailing list