-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Show the URL of streaming WASM modules in stack traces
WebAssembly modules compiled through `WebAssembly.compile()` and similar non-streaming APIs don't have a URL associated to them, because they have been compiled from a buffer source. In stack traces, V8 will use a URL such as `wasm://wasm/d1c677ea`, with a hash of the module. However, wasm modules compiled through streaming APIs, like `WebAssembly.compileStreaming()`, do have a known URL, which can be obtained from the `Response` object passed into the streaming APIs. And as per the developer-facing display conventions in the WebAssembly Web API spec, this URL should be used in stack traces. This change implements that. Closes #12151.
- Loading branch information
Andreu Botella
committed
Oct 7, 2021
1 parent
c4b995f
commit 4fc837f
Showing
9 changed files
with
45 additions
and
47 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
Binary file not shown.
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 |
---|---|---|
@@ -1,50 +1,9 @@ | ||
// WebAssembly module containing a single function with an unreachable instruction | ||
const binary = Uint8Array.from([ | ||
0x00, | ||
0x61, | ||
0x73, | ||
0x6d, | ||
0x01, | ||
0x00, | ||
0x00, | ||
0x00, | ||
0x01, | ||
0x04, | ||
0x01, | ||
0x60, | ||
0x00, | ||
0x00, | ||
0x03, | ||
0x02, | ||
0x01, | ||
0x00, | ||
0x07, | ||
0x0f, | ||
0x01, | ||
0x0b, | ||
0x75, | ||
0x6e, | ||
0x72, | ||
0x65, | ||
0x61, | ||
0x63, | ||
0x68, | ||
0x61, | ||
0x62, | ||
0x6c, | ||
0x65, | ||
0x00, | ||
0x00, | ||
0x0a, | ||
0x05, | ||
0x01, | ||
0x03, | ||
0x00, | ||
0x00, | ||
0x0b, | ||
]); | ||
const binary = await Deno.readFile("./unreachable.wasm"); | ||
|
||
const module = new WebAssembly.Module(binary); | ||
const instance = new WebAssembly.Instance(module); | ||
|
||
// Compare the stack trace with wasm_url.js, which compiles the WASM module with | ||
// streaming APIs. | ||
instance.exports.unreachable(); |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
error: Uncaught RuntimeError: unreachable | ||
at <anonymous> (wasm://wasm/[WILDCARD]) | ||
error: Uncaught (in promise) RuntimeError: unreachable | ||
at <anonymous> (wasm://wasm/d1c677ea:1:41) | ||
at [WILDCARD]/wasm_unreachable.js:[WILDCARD] |
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,8 @@ | ||
const module = await WebAssembly.compileStreaming( | ||
fetch("http://localhost:4545/unreachable.wasm"), | ||
); | ||
const instance = new WebAssembly.Instance(module); | ||
|
||
// Compare the stack trace with wasm_unreachable.js, which compiles the WASM | ||
// module with synchronous APIs. | ||
instance.exports.unreachable(); |
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,3 @@ | ||
error: Uncaught (in promise) RuntimeError: unreachable | ||
at <anonymous> (http://localhost:4545/unreachable.wasm:1:41) | ||
at [WILDCARD]/wasm_url.js:[WILDCARD] |
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