-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add support for unwinding #62
Comments
I'd like to try to help with this. |
This issue is very hard so I suggest you start with one of the good first issues. If you still wanna try, I'll upload my branch of libgccjit that starts adding support for try/catch and I suggest to start looking at the |
Can invoke be codegened as a try + catch with the catch goto'ing to the landingpad? |
That's an interesting idea, actually. I didn't think of doing that. Maybe that would work. |
Actually I was thinking the entire block should have a try/catch around it, so that the result of the invoke can be saved. I don't understand yet what the result of the llvm |
When the personality function runs it searches for the location of the cleanup code in a compiler generated table ( When you jump out of the catch to get to the landingpad does gcc insert a function call to indicate that unwinding is finished? If so, my suggestion won't work. If it doesn't do you know how to run the unwind continue/finish functions? (at machine evel a tail call to |
I haven't actually tried it at the GENERIC level, but I tried supposedly equivalent C++ code and I think it does :( It calls https://compiler-explorer.com/z/Kadvfz81W So I guess maybe the proper behavior is to have all the blocks that are only reachable from the catch side of btw, will the |
Rust doesn't use the C++ standard library, so it uses |
Are unwind tables necessary? Can |
Unwind tables are necessary for DWARF based unwinding. There is also the older SjLj based unwinding which doesn't need unwind tables, but still needs support from the compiler backend AFAIK. Other than that the only option is to change ABI to return a pointer optionally representing the panic and checking this pointer after every call. |
Looks like at least for GIMPLE the
should work I think @antoyo. |
I think I'll try it with the goto then and see if it works |
I haven't touched that gcc branch in a while, so it might not work correctly (and there's a bit more stuff to implement) but here it is. It adds support to set the personality function and try/catch. @sapir I hope that helps! |
I've pushed my work so far to this branch (gcc) and this branch (rustc_codegen_gcc) |
@sapir : Any progress on this? If you're not working on this anymore, I'll start working on this myself soon. |
@antoyo sorry! I'm not working on this now, I hope the branches I pushed help |
Some notes to myself to debug the issue in release mode:
The text was updated successfully, but these errors were encountered: