You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
0 commit comments