-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 hooks for Miri panic unwinding #60026
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
r? @RalfJung |
@RalfJung: Are there any changes that you'd like me to make? |
Sorry, I didn't yet have the chance to look at this. It's on my list though! |
I am a bit surprised by the implementation strategy here. Logically speaking, what happens with unwinding is that every function has two "return continuations", as in, two "return addresses" that it might jump to when execution is done: the successful one for normal completion, and the "unwind" address for when unwinding is happening. So, what I'd expect is that I think with that approach you can also keep using the normal interpreter loop in Is there a particular reason you chose the approach you did (which I am still trying to understand)? |
Also, this is super cool! I didn't expect unwind support for Miri to happen any time soon, so I am very happy to see you tackle this. :) |
@RalfJung: My main goal was to make the minimum amount of changes to |
TBH that sounds like overkill to me. The action that happens on a pop is so simple (just take the unwind continuation instead of the return continuation), I don't think this warrants the mental overhead of a machine hook. I mean, it's literally just |
I have no personal preference. I was mainly aiming to explain how to achieve @Aaron1011 's target |
5a5b99e
to
8aa3d5d
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
1ae1ec5
to
32542b4
Compare
@RalfJung: I've made the changes you requested |
☔ The latest upstream changes (presumably #61278) made this pull request unmergeable. Please resolve the merge conflicts. |
32542b4
to
3b7be70
Compare
☔ The latest upstream changes (presumably #61467) made this pull request unmergeable. Please resolve the merge conflicts. |
Add hooks for Miri panic unwinding This commits adds in some additional hooks to allow Miri to properly handle panic unwinding. None of this should have any impact on CTFE mode This supports rust-lang/miri#693
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
💔 Test failed - checks-azure |
It looks like @RalfJung Can you re-try this? |
4GB memory allocation during compilation of hex is a lot. |
Note that |
Well let's try one last time. @bors retry rollup=never |
Add hooks for Miri panic unwinding This commits adds in some additional hooks to allow Miri to properly handle panic unwinding. None of this should have any impact on CTFE mode This supports rust-lang/miri#693
☀️ Test successful - checks-azure |
Support unwinding after a panic Fixes #658 This commit adds support for unwinding after a panic. It requires a companion rustc PR to be merged, in order for the necessary hooks to work properly. Currently implemented: * Selecting between unwind/abort mode based on the rustc Session * Properly popping off stack frames, unwinding back the caller * Running 'unwind' blocks in Mir terminators Not yet implemented: * 'Abort' terminators This PR was getting fairly large, so I decided to open it for review without implementing 'Abort' terminator support. This could either be added on to this PR, or merged separately. I've a test to exercise several different aspects of unwind panicking. Ideally, we would run Miri against the libstd panic tests, but I haven't yet figured out how to do that. This depends on rust-lang/rust#60026
Support unwinding after a panic Fixes #658 This commit adds support for unwinding after a panic. It requires a companion rustc PR to be merged, in order for the necessary hooks to work properly. Currently implemented: * Selecting between unwind/abort mode based on the rustc Session * Properly popping off stack frames, unwinding back the caller * Running 'unwind' blocks in Mir terminators Not yet implemented: * 'Abort' terminators This PR was getting fairly large, so I decided to open it for review without implementing 'Abort' terminator support. This could either be added on to this PR, or merged separately. I've a test to exercise several different aspects of unwind panicking. Ideally, we would run Miri against the libstd panic tests, but I haven't yet figured out how to do that. This depends on rust-lang/rust#60026
Support unwinding after a panic Fixes #658 This commit adds support for unwinding after a panic. It requires a companion rustc PR to be merged, in order for the necessary hooks to work properly. Currently implemented: * Selecting between unwind/abort mode based on the rustc Session * Properly popping off stack frames, unwinding back the caller * Running 'unwind' blocks in Mir terminators Not yet implemented: * 'Abort' terminators This PR was getting fairly large, so I decided to open it for review without implementing 'Abort' terminator support. This could either be added on to this PR, or merged separately. I've a test to exercise several different aspects of unwind panicking. Ideally, we would run Miri against the libstd panic tests, but I haven't yet figured out how to do that. This depends on rust-lang/rust#60026
This commits adds in some additional hooks to allow Miri to properly
handle panic unwinding. None of this should have any impact on CTFE mode
This supports rust-lang/miri#693