-
Notifications
You must be signed in to change notification settings - Fork 162
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
support abort the VM execution from imported function call. #58
Comments
seems this feature is supported in this wasmer pr167. |
Thanks for the suggestion. This is an interesting feature to implement. That's not an easy one though, because Go uses the C API of Wasmer. Let's see how far we can go! |
Just a heads up to say I'm not forgetting this. The trapping system for host functions (aka imported functions) are implemented in Rust. For the C API, and therefore for Go, there is nothing, and I'm thinking of a new API for that. It'll take some time though. |
I would really like to see this as I am trying to recover from panics in my host functions and this is sometimes causing stack smashing, which is unrecoverable. This problem seems somewhat unpredictable, so a safe way to TRAP from within a host function is critical to my application. I really like the panic()/recover() paradigm for this. @Hywan, can you point me at the API in Rust for this, and also any work on the Rust/C API so far? I would like to use this in my application ahead of it getting merged here. I will open PRs for any progress that I make on it. |
Yeah, I'm thinking about it but it's not that obvious. I can focus on it next days. |
Thanks @Hywan for linking to this, from the issue's title it didn't seem connected but yeah, seems like the same problem. In my case it's the same, need to trap them and can probably go some lengths getting this done as it's the last part before I can try my experiment in the real world :) Ideally wasmer would return an error, less ideal scenario would be to put |
Yeah, we should break our C API, and I'm not sure whether it's a good idea or not. I'm thinking about introducing a new C API for such cases instead. |
This feature is now implemented in wasmer-go. You can have a look at |
Motivation
In our use case, we need do some check in the imported go function, if check failed, it means a fatal error, and we need abort the whole VM execution, so add a
InstanceContext.Trap(err)
like method for imported function to call will be helpful.The text was updated successfully, but these errors were encountered: