Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower WASM exceptions to MVP (or maybe GC) #7179

Open
gkgoat1 opened this issue Dec 24, 2024 · 1 comment
Open

Lower WASM exceptions to MVP (or maybe GC) #7179

gkgoat1 opened this issue Dec 24, 2024 · 1 comment

Comments

@gkgoat1
Copy link

gkgoat1 commented Dec 24, 2024

Many C++ libraries require exceptions, like libriscv and Binaryen itself. Compiling them to WASI would work (as wasi-sdk, iirc, supports WASM exceptions), but some WASM parsers (like my fork of waffle) and WASM compilers (like w2c2) do not.

For compatibility with those compilers and parsers, we would need a WASM exception lowering pass. Generically, the only sound option is lowering to GC, however MVP lowering might be required for some usages, where we would redirect exception data to either a seperate memory or an unused segment of the existing one.

As one of the few WASM analysis tools that support exceptions, Binaryen seems fit to contain some exception lowering pass, even if it would be unnecessary for most pure-Binaryen workloads.

@kripken
Copy link
Member

kripken commented Dec 30, 2024

So far this hasn't come up because e.g. C++ users can recompile to switch between wasm exceptions and not, but if there are toolchains that only emit exceptions then I agree a lowering pass could make sense here. A contribution of such a pass sounds good in general, as Binaryen does have lowering passes for several other features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants