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

[FEATURE REQUEST] Optimize exceptions #117

Open
vouillon opened this issue Oct 24, 2024 · 0 comments
Open

[FEATURE REQUEST] Optimize exceptions #117

vouillon opened this issue Oct 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@vouillon
Copy link
Collaborator

Exceptions are slow in Wasm since the stack is unwound in a generic way.

One could experiment with changing the calling convention to return null on exception (storing the exception in a global value). That should not be too much work since it only involves the generated code (and the runtime code to invoke callbacks). The runtime would still throw Wasm exceptions.

Another approach would be to change the calling convention only for functions that may throw an exception and which we know are called from within an exception handler. If the optimized function may escape, we can call it from a wrapper function that will raise a Wasm exception. This will cover many cases like searching in a list or a map while keeping a faster calling convention in most cases.

@vouillon vouillon added the enhancement New feature or request label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant