Conversation
|
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
|
⌛ Trying commit 97c23fdb1834d1669314cc73b3b31a9cb451e28a with merge 14b72f38ec9756851f7af637cd45f181890e3bd7... |
This comment has been minimized.
This comment has been minimized.
|
☀️ Try build successful - checks-actions |
|
Queued 14b72f38ec9756851f7af637cd45f181890e3bd7 with parent 0035d9d, future comparison URL. |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking try commit (14b72f38ec9756851f7af637cd45f181890e3bd7): comparison url. Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @bors rollup=never |
|
There seems to be no impact on performance and binary size increases by only 0.1%, so I think we can simply remove The only remaining issue is deciding how we should expose the ability to have OOM unwind to users:
|
|
I think benchmarking compiler is not very relevant here. Std's microbenchmarks should give more meaningful results. |
|
I disagree, the compiler is a great benchmark because it makes a lot of memory allocations as part of the compilation process (usually through |
|
This issue documented the binary size blowup that happened the first time they started allowing unwinding on oom: #42808. We should do all the same checks they did to make sure we're not reintroducing the same issues. |
|
I ran the same tests: on the serde one the size increase was only 0.8%, on the In conclusion I think this is an entirely reasonable tradeoff for allowing OOM to be handled in user code. |
|
That's a surprisingly small overhead. I am uncertain if there are any code currently assuming that handle_alloc_error won't unwind though, since |
|
One particular worry is that |
|
You're right, the drop isn't getting called in this example: #![feature(box_syntax)]
use std::panic::catch_unwind;
struct Foo;
impl Drop for Foo {
fn drop(&mut self) {
println!("Foo dropped");
}
}
fn main() {
catch_unwind(|| {
let foo = Foo;
let a = box [0u8; 1024*1024*1024];
let b = box [0u8; 1024*1024*1024];
let c = box [0u8; 1024*1024*1024];
let d = box [0u8; 1024*1024*1024];
println!("No oom");
});
println!("Caught unwind!");
}I'm not sure how difficult it would be to make |
|
I think rust/library/alloc/src/alloc.rs Line 392 in a49e38e C-unwind as abi.
Edit: |
|
📌 Commit aa36237 has been approved by |
|
⌛ Testing commit aa36237 with merge d8dbcea50d1273641d256cb9a884d1a930ea4c6e... |
This comment has been minimized.
This comment has been minimized.
|
💔 Test failed - checks-actions |
|
Looks like you accidentally committed a change to the src/tools/rust-analyzer submodule. |
|
My bad, this sometimes happens when switching between branches that have different submodule commits checked out. |
|
@bors r=nagisa |
|
📌 Commit 0254e31 has been approved by |
|
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
|
⌛ Testing commit 0254e31 with merge 987e5b0c45dddba1b7ea8aff8a82d491400fd364... |
|
💔 Test failed - checks-actions |
|
@bors retry Accidentally cancelled this. |
|
⌛ Testing commit 0254e31 with merge a8f752f012f12dbeff295ee772d568ebc1d9b08a... |
|
💔 Test failed - checks-actions |
|
@bors retry Waiting on getting CI working. |
|
@bors treeclosed- |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (d6f3a4e): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
This PR removes the
#[rustc_allocator_nounwind]attribute onalloc_error_handlerwhich allows it to unwind with a panic instead of always aborting. This is then used to implement-Z oom=panicas per RFC 2116 (tracking issue #43596).Perf and binary size tests show negligible impact.