]> git.lizzy.rs Git - rust.git/commitdiff
Mark cleanup cold
authorMark Rousskov <mark.simulacrum@gmail.com>
Thu, 26 Dec 2019 15:54:24 +0000 (10:54 -0500)
committerAmanieu d'Antras <amanieu@gmail.com>
Mon, 2 Mar 2020 11:43:07 +0000 (11:43 +0000)
src/libstd/panicking.rs

index f71849fae34fa3afe1bcdfb2d556da45e19f34e9..3dd1f09e07656f819cdc024a4c641a0f123578e3 100644 (file)
@@ -307,6 +307,11 @@ union Data<F, R> {
         Err(cleanup(payload.assume_init()))
     };
 
+    // We consider unwinding to be rare, so mark this function as cold. However,
+    // do not mark it no-inline -- that decision is best to leave to the
+    // optimizer (in most cases this function is not inlined even as a normal,
+    // non-cold function, though, as of the writing of this comment).
+    #[cold]
     unsafe fn cleanup(mut payload: Payload) -> Box<dyn Any + Send + 'static> {
         let obj = crate::mem::transmute(__rust_panic_cleanup(&mut payload as *mut _ as *mut u8));
         update_panic_count(-1);