Skip to content

Conversation

@graalvmbot
Copy link
Collaborator

The new exception handling proposal as opposed to the legacy one uses a new try_table block for exception catching, if inside that block an exception is thrown, Wasm breaks to the block specified in the try_table's catch clauses. This makes exception control-flow the same as any other break-based control-flow, but makes it a bit harder for us.

This required support for Wasm blocks that return a result, which also made the validator more complex.

The new exception handling is used by default. The legacy proposal can be re-enabled using -H:+LegacyExceptions. In node (before version 25), the new exceptions are behind the --experimental-wasm-exnref flag.


WithExceptionNodes are now lowered to the following (see WasmIRWalker#lowerWithException for more details):

(block $exnBlock (result $throwable)
    (try_table (catch $exc_tag $exnBlock)
        WithExceptionNode();
        br Successor
    )
)
(local.set $exc_var)
ExceptionEdge();

This is optimal in terms of number of required blocks.

This does not seem to have an effect on code size.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 29, 2025
@graalvmbot graalvmbot force-pushed the pz/GR-54677-exceptions branch from 2c36a18 to af545ea Compare October 31, 2025 15:58
@graalvmbot graalvmbot force-pushed the pz/GR-54677-exceptions branch from af545ea to 880aa24 Compare November 6, 2025 15:25
@graalvmbot graalvmbot merged commit 6417d99 into master Nov 7, 2025
13 checks passed
@graalvmbot graalvmbot deleted the pz/GR-54677-exceptions branch November 7, 2025 14:54
@reneleonhardt
Copy link

All 3 features of WASM 3 mentioned as implemented are specifically shown as unimplemented by the latest news:
https://webassembly.org/news/2025-09-17-wasm-3.0/

Have Garbage Collection, Exception Handling and Typed Function References been implemented?
If they are, can they be marked as implemented in the WASM 3 news and the features overview?

https://webassembly.org/features/

@patrick96
Copy link
Member

This PR is about Web Image, a JVM bytecode to Wasm compiler, not the GraalWasm runtime.

Though WasmGC support seems to be on its way for GraalWasm as well: #12701

@reneleonhardt
Copy link

Should Web Image be added to the webassembly.org implementations then, separate from GraalWasm?

@oracle oracle deleted a comment from patrick96 Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants