Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[JSC] fix wrong text in WASM error message
https://bugs.webkit.org/show_bug.cgi?id=247280 rdar://101023980 Reviewed by Yusuke Suzuki. Fix WASM error message for `local.get`. * JSTests/stress/wasm-error-message-get-local.js: Added. (shouldBe): (async let): * Source/JavaScriptCore/wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseIndexForLocal): Canonical link: https://commits.webkit.org/256176@main
- Loading branch information
Showing
2 changed files
with
26 additions
and
3 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,23 @@ | ||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error('bad value: ' + actual); | ||
} | ||
|
||
const log = globalThis.console?.log ?? debug; | ||
|
||
let expected = "--> CompileError: WebAssembly.Module doesn't validate: attempt to use unknown local 5, the number of locals is 5, in function at index 0"; | ||
|
||
/* | ||
(module | ||
(type (;0;) (func (result i64))) | ||
(func (;0;) (type 0) (result i64) | ||
(local i64 i64 i64 i64 i64) | ||
local.get 5)) | ||
*/ | ||
|
||
(async function () { | ||
let bytes = new Uint8Array([0x0, 0x61, 0x73, 0x6d, 0x1, 0x0, 0x0, 0x0, 0x1, 0x5, 0x1, 0x60, 0x0, 0x1, 0x7e, 0x3, 0x2, 0x1, 0x0, 0xa, 0x8, 0x1, 0x6, 0x1, 0x5, 0x7e, 0x20, 0x5, 0xb]); | ||
await WebAssembly.instantiate(bytes, {}); | ||
})() | ||
.then(() => log('bye')) | ||
.catch(e => shouldBe(e, expected)); |
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