-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-land [WASM-Function-References] Fix block signature parsing for re…
…ftypes https://bugs.webkit.org/show_bug.cgi?id=247383 Reviewed by Justin Michaud. This is a re-land of this patch, with some adjustment to hopefully improve performance in benchmarks (previous attempt backed out due to JetStream2 regression). * JSTests/wasm/function-references/block_signature.js: Added. (module): (async blockSignatureTest): * JSTests/wasm/gc-spec-tests/type-equivalence.wast.js: * Source/JavaScriptCore/wasm/WasmFormat.h: * Source/JavaScriptCore/wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::unify): * Source/JavaScriptCore/wasm/WasmParser.h: (JSC::Wasm::Parser<SuccessType>::parseBlockSignature): (JSC::Wasm::Parser<SuccessType>::parseReftypeSignature): Canonical link: https://commits.webkit.org/266847@main
- Loading branch information
Showing
5 changed files
with
88 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
//@ runWebAssemblySuite("--useWebAssemblyTypedFunctionReferences=true") | ||
import * as assert from '../assert.js'; | ||
|
||
function module(bytes, valid = true) { | ||
let buffer = new ArrayBuffer(bytes.length); | ||
let view = new Uint8Array(buffer); | ||
for (let i = 0; i < bytes.length; ++i) { | ||
view[i] = bytes.charCodeAt(i); | ||
} | ||
return new WebAssembly.Module(buffer); | ||
} | ||
|
||
async function blockSignatureTest() { | ||
/* | ||
(module | ||
(type (func)) | ||
(func (type 0)) | ||
(elem declare funcref (ref.func 0)) | ||
(func (result) | ||
(block (result (ref 0)) | ||
(ref.func 0)) | ||
drop) | ||
) | ||
*/ | ||
new WebAssembly.Instance(module("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x83\x80\x80\x80\x00\x02\x00\x00\x09\x87\x80\x80\x80\x00\x01\x07\x70\x01\xd2\x00\x0b\x0a\x96\x80\x80\x80\x00\x02\x82\x80\x80\x80\x00\x00\x0b\x89\x80\x80\x80\x00\x00\x02\x6b\x00\xd2\x00\x0b\x1a\x0b")); | ||
|
||
/* | ||
(module | ||
(type (func)) | ||
(func (result) | ||
(block (result (ref null 0)) | ||
(ref.null 0)) | ||
drop) | ||
) | ||
*/ | ||
new WebAssembly.Instance(module("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\x02\x6c\x00\xd0\x00\x0b\x1a\x0b")); | ||
|
||
// Both shorthand and Ref encodings tested below. | ||
/* | ||
(module | ||
(func (result) | ||
(block (result (ref null extern)) | ||
(ref.null extern)) | ||
drop) | ||
) | ||
*/ | ||
new WebAssembly.Instance(module("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x02\x6f\xd0\x6f\x0b\x1a\x0b")); | ||
new WebAssembly.Instance(module("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\x02\x6c\x6f\xd0\x6f\x0b\x1a\x0b")); | ||
|
||
/* | ||
(module | ||
(func (result) | ||
(block (result (ref null func)) | ||
(ref.null func)) | ||
drop) | ||
) | ||
*/ | ||
new WebAssembly.Instance(module("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x02\x70\xd0\x70\x0b\x1a\x0b")); | ||
new WebAssembly.Instance(module("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\x02\x6c\x70\xd0\x70\x0b\x1a\x0b")); | ||
} | ||
|
||
assert.asyncTest(blockSignatureTest()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters