WebAssembly / WASI

WebAssembly System Interface
Other
4.75k stars 243 forks source link

setjmp support #490

Closed calvin2021y closed 1 year ago

calvin2021y commented 2 years ago

current sdk ./share/wasi-sysroot/include/c++/v1/setjmp.h is not working.

please share the roadmap for this sdk to support setjmp, I want use it in https://github.com/protocolbuffers/upb

sunfishcode commented 2 years ago

The current plan is to wait for the exception-handling proposal to be standardized and implemented in wasm engines, and then to implement setjmp and longjmp using that feature. Exception-handling is currently in phase 3.

Another option would be to define a host API which performs stack unwinding. We've so far not pursued this approach, because that would be a lot of complex work for non-JS host API implementors, for what would ultimately be a temporary workaround. And, such an API would not be virtualizable, and would raise complex questions about non-C-language unwinding which the exception-handling proposal already has answers for.

sunfishcode commented 1 year ago

The original question is answered; please file new issues for any further questions!

namse commented 1 month ago

@sunfishcode According to https://github.com/WebAssembly/exception-handling/issues/179, it seems that most browsers have completed the implementation. It's in Phase 3, but since the implementation has been completed, would it be okay to provide support for it?

sunfishcode commented 1 month ago

Yes, an implementation is now merged into wasi-libc in https://github.com/WebAssembly/wasi-libc/pull/483.