-
Notifications
You must be signed in to change notification settings - Fork 36
Fix exception handling (throw) in xeus-cpp-lite. #222
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
Comments
The trace indicates that the
|
Going through emscripten's flags they also provide an error like this. We might be missing the flag responsible for enabling exceptions somewhere.
|
@anutosh491 As far as I can tell from the linked repo exception handling isn't currently supported by WebAssembly https://github.com/WebAssembly/exception-handling/tree/master , but the repo contains a proposal on how they hope to add support for it. |
Hmm, weird. That shouldn't be the case cause as I wrote about the linking step is fine which means we are creating a wasm module out of the "throw" command. It's the loading that is not working as expected. So I am guessing we should be able to do this ! |
This is the wasm module being generated for
|
@anutosh491 The -fexceptions and -fwasm-exceptions flags may be relevant this PR (saw them in this issue emscripten-core/emscripten#22587 ) |
Hi, I was able to find the solution for this but might need some guidance on where it should be placed. Let me briefly explain what is happening here.
So it is one of these steps that is going wrong.
This establishes the fact that the step going from LLVM IR -> incr_module_xx.so is going wrong. Let's move on to the Reasoning now |
REASONING
But yeah you can see the correct wasm being generated for a try-catch block Let's move onto the solution now |
SOLUTION
This can be done either through i) Adding it straightaway in CreateCpp But to my surprise this doesn't solve the problem. This is what happens For usual clang For clang-repl i) Everything starts with BuildCompilation which does the
iv) Now just like clang normally would do, we need a call to So basically the point is clang-repl doesn't deal with |
SOLUTION Contd Now if you look at how clang is dealing with this, the following happens
We need to replicate something similar in clang-repl. Once we create the For eg talking about version. If we pass version as a flag to the cc1 command using ( This is because
My understanding tells me that "client" here means the object making use of the CompileInstance which in our case ends up being the Interpreter class. I say this because the solution i propose can also end up in Hence we can start with something like this
This should get us started with handling things like clang is doing.
|
I would expect this to work with what is there as of now but I see the following doesn't work
So out of all the steps (code -> PTU -> LLVM IR -> wasm object -> wasm binary -> loaded on top of main module using dlopen) we need to think which one is going wrong.
The linking step through clang-repl is successful here and hence a shared wasm module has been created.
But the dlopen step to load it on top of the main module is not working as expected. Hence the trace
The text was updated successfully, but these errors were encountered: