Commit 9a7230f
authored
[EH] Rename EH library functions in JS (#17183)
Terms like 'object' and 'value' were used interchangeably and
inconsistently, causing confusion. This tries to make it more
consistent.
- Thrown object: A user-thrown value in C++, which is a C++ pointer.
When you do `throw 3;`, libc++abi allocates a storage to store an
exception and store that value '3' within that storage. This is the
pointer to that location. This is consistent with the term used by
libc++abi; which also calls the pointer 'thrown object'. Emscripten EH
throws this directly, so you get this value right away when you catch
an exception with JS `catch`. In Wasm EH, which uses libc++abi, this
is not the value libc++abi actually throws. See below.
- Unwind header: The pointer that actually gets thrown in libc++abi.
This pointer preceeds the thrown object:
https://github.com/emscripten-core/emscripten/blob/24f765dc3545e89f232c9f8503f6426055271628/system/lib/libcxxabi/src/cxa_exception.cpp#L26-L28
This is an internal detail of libc++abi so we don't want to expose
this to users. Emscripten EH doesn't use this concept.
- WebAssembly exception: A native Wasm exception, represented by
`WebAssembly.Exception` JS object. This is what is actually gets
thrown from Wasm `throw` instruction. libunwind receives the unwind
header pointer (see above) from libc++abi, and create an
`WebAssembly.Exception` object and package the received value with the
C++ exception tag, and throws it. So this is what you get when you
catch a Wasm exception with JS `catch`.
Relevant previous discussion: #17157 (review)1 parent 47ca906 commit 9a7230f
1 file changed
+18
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | | - | |
402 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
403 | 408 | | |
404 | 409 | | |
405 | | - | |
406 | | - | |
| 410 | + | |
| 411 | + | |
407 | 412 | | |
408 | 413 | | |
409 | | - | |
410 | | - | |
411 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
412 | 417 | | |
413 | 418 | | |
414 | 419 | | |
415 | | - | |
416 | | - | |
417 | | - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
418 | 423 | | |
419 | 424 | | |
420 | 425 | | |
421 | | - | |
422 | | - | |
| 426 | + | |
| 427 | + | |
423 | 428 | | |
424 | 429 | | |
425 | | - | |
| 430 | + | |
426 | 431 | | |
427 | 432 | | |
428 | 433 | | |
| |||
0 commit comments