diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-12-26 10:54:24 -0500 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2020-03-02 11:43:07 +0000 |
| commit | bdcc02360f34fe773c38f8ae86111fb831f8ec9e (patch) | |
| tree | bf8df684a3c8ba76aea724e588ebca2e4d81b251 /src/libstd | |
| parent | dd6c3b7c3900f58f5b97a6cec379328e855287ed (diff) | |
| download | rust-bdcc02360f34fe773c38f8ae86111fb831f8ec9e.tar.gz rust-bdcc02360f34fe773c38f8ae86111fb831f8ec9e.zip | |
Mark cleanup cold
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/panicking.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index f71849fae34..3dd1f09e076 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -307,6 +307,11 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>> 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); |
