Skip to content

Commit f3da0ea

Browse files
Mark-SimulacrumAmanieu
authored andcommitted
Mark cleanup cold
1 parent 3109036 commit f3da0ea

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libstd/panicking.rs

+5
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
300300
Err(cleanup(payload.assume_init()))
301301
};
302302

303+
// We consider unwinding to be rare, so mark this function as cold. However,
304+
// do not mark it no-inline -- that decision is best to leave to the
305+
// optimizer (in most cases this function is not inlined even as a normal,
306+
// non-cold function, though, as of the writing of this comment).
307+
#[cold]
303308
unsafe fn cleanup(mut payload: Payload) -> Box<dyn Any + Send + 'static> {
304309
let obj = crate::mem::transmute(__rust_panic_cleanup(&mut payload as *mut _ as *mut u8));
305310
update_panic_count(-1);

0 commit comments

Comments
 (0)