Stream: git-wasmtime

Topic: wasmtime / Issue #2049 Exception support


view this post on Zulip Wasmtime GitHub notifications bot (Jul 20 2020 at 19:09):

carlokok opened Issue #2049:

<!-- Please try to describe precisely what you would like to do in
Cranelift/Wasmtime and/or expect from it. You can answer the questions below if
they're relevant and delete this text before submitting. Thanks for opening an
issue! -->

Feature

Cranelift currently doesn't support SEH (but has some support for finally I think). This is a feature request to support properly exception (landingpads on Posix, SEH on windows, maybe SLJL for others)

Benefit

WASM has plans to support exceptions, at which point it's going to be needed. Win64 has partial SEH support (iirc it just emits what's needed, nothing more), this would allow for c++ /java/.net exception support.

Implementation

Tricky one. I know LLVM has two alternative ways of doing this. I think with that in mind it should be possible to do a single implementation. What's basically needed is a way to say:
from here
[code]

till here is a protected block, on exceptions go to X, for finalization go to Y. For the handler itself it should be possible to define the personality to call.

Throw, Rethrow etc can all probably be done on a library level.

Alternatives

The only alternative is to not do it.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 20 2020 at 19:17):

bjorn3 commented on Issue #2049:

Duplicate of https://github.com/bytecodealliance/wasmtime/issues/1677

view this post on Zulip Wasmtime GitHub notifications bot (Jul 20 2020 at 19:39):

carlokok commented on Issue #2049:

I agree it's related, but unwind and catch are slightly distinct actions and your issue doesn't cover that?

view this post on Zulip Wasmtime GitHub notifications bot (Jul 20 2020 at 20:43):

bjorn3 commented on Issue #2049:

Catch is implemented by returning _URC_HANDLER_FOUND instead of _URC_INSTALL_CONTEXT from the personality function and then jumping from the landing pad to the block handling the catch instead of calling _Unwind_Resume like for cleanup.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 03 2021 at 20:02):

bjorn3 commented on Issue #2049:

Given the above comments I think this can be closed as duplicate.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 03 2021 at 20:11):

carlokok commented on Issue #2049:

I missed your reply last year but does that cover windows at all? Windows doesn't use personalities? At least not like that?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 03 2021 at 20:18):

bjorn3 commented on Issue #2049:

SEH seems to use exception handlers and termination handlers. I think catching an exception instead of doing cleanup is done by using an exception handler instead of termination handler. This is based on a cursory reading of the docs though, so I may be wrong. In any case both catching exceptions and cleanup needs the same codegen handling to support an alternative location to which a call can "return".


Last updated: Oct 23 2024 at 20:03 UTC