-
Notifications
You must be signed in to change notification settings - Fork 75
Implement unwinding #244
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
Implement unwinding #244
Conversation
src/builder.rs
Outdated
|
||
let current_block = self.block.clone(); | ||
self.block = try_block; | ||
let call = self.call(typ, func, args, None); // TODO: use funclet here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funclets are only for implementing SEH unwinding on Windows. GCC may or may not generate them automatically behind the scenes (in which case cg_ssa should be changed to not use funclets with GCC), but LLVM requires explicitly using them instead of landing pads when using SEH. In case you didn't know, funclets are kind of functions, except that they share the stack frame with another function. In SEH a funclet is called by the unwinder for every frame that needs cleanup, unlike on Unix where the unwinder moves the IP to a landingpad and then returns, the landingpad then tail calls back into the unwinder to continue with the next frame.
// TODO(bjorn3): Properly implement unwinding. | ||
fn resume(&mut self, exn: RValue<'gcc>) { | ||
// TODO: check if this is normal that we need to dereference the value. | ||
let exn = exn.dereference(None).to_rvalue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exn here should be a struct forming a pair with the same values as the landing pad returned. By the way in the latest rustc I changed cleanup_landing_pad and resume to return/accept two separate values rather than a single pair value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I haven't sync with rustc for a while because I was having issues. I'll try to do it soon.
081c63a
to
ea75295
Compare
🎉 |
No description provided.