-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Custom MIR: Support cleanup blocks #117330
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
Conversation
|
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
73d4334 to
bff1419
Compare
This comment has been minimized.
This comment has been minimized.
bff1419 to
9e68f0c
Compare
|
The Miri subtree was changed cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
9e68f0c to
f54f88f
Compare
library/core/src/intrinsics/mir.rs
Outdated
| //! | ||
| //! { | ||
| //! Call(_unused = Vec::push(v, value), pop) | ||
| //! Call(_unused = Vec::push(v, value), pop, Continue()) |
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.
It seems like most of the time we want Continue. So maybe with can have Call always use the default unwind action of Continue, and then have CallWithUnwind for when one wants something else? Or maybe some other way to have default values.
library/core/src/intrinsics/mir.rs
Outdated
| //! | ||
| //! pop = { | ||
| //! Call(popped = Vec::pop(v), drop) | ||
| //! Call(popped = Vec::pop(v), drop, Continue()) |
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.
This makes me wonder if we should replace Call(popped = Vec::pop(v), drop) by Call(popped = Vec::pop(v), ReturnTo(drop)) or something like that... basically emulating named arguments. That's orthogonal to your PR though so I'd also be happy to do it as a follow-up if you prefer.
1c827a9 to
73ff6c9
Compare
This comment has been minimized.
This comment has been minimized.
73ff6c9 to
d58e6d9
Compare
This comment has been minimized.
This comment has been minimized.
d58e6d9 to
2f0d557
Compare
2f0d557 to
fc64498
Compare
fc64498 to
efe98b3
Compare
e059888 to
3d89c80
Compare
|
@bors r+ |
…=cjgillot
Custom MIR: Support cleanup blocks
Cleanup blocks are declared with `bb (cleanup) = { ... }`.
`Call` and `Drop` terminators take an additional argument describing the unwind action, which is one of the following:
* `UnwindContinue()`
* `UnwindUnreachable()`
* `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup`
* `UnwindCleanup(block)`
Also support unwind resume and unwind terminate terminators:
* `UnwindResume()`
* `UnwindTerminate(reason)`
This comment has been minimized.
This comment has been minimized.
|
💔 Test failed - checks-actions |
Cleanup blocks are declared with `bb (cleanup) = { ... }`.
`Call` and `Drop` terminators take an additional argument describing the
unwind action, which is one of the following:
* `UnwindContinue()`
* `UnwindUnreachable()`
* `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup`
* `UnwindCleanup(block)`
Also support unwind resume and unwind terminate terminators:
* `UnwindResume()`
* `UnwindTerminate(reason)`
3d89c80 to
78da577
Compare
Added By the way, it seems quite suspect that MIR validity depends on the current panic strategy, since it means that code generation operates on invalid MIR when it originates from a crate with a different panic strategy. |
|
@bors r=cjgillot |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (5526682): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 672.988s -> 673.782s (0.12%) |
Cleanup blocks are declared with
bb (cleanup) = { ... }.CallandDropterminators take an additional argument describing the unwind action, which is one of the following:UnwindContinue()UnwindUnreachable()UnwindTerminate(reason), where reason isReasonAbiorReasonInCleanupUnwindCleanup(block)Also support unwind resume and unwind terminate terminators:
UnwindResume()UnwindTerminate(reason)