From fae60b36cb48b1d5827eaaee656f0ff1a6cc6894 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 11 Aug 2017 15:59:11 -0700 Subject: [PATCH] std: Tag OOM functions as `#[cold]` This was forgotten from #42727 by accident, but these functions are rarely called and codegen can be improved in LLVM with the `#[cold]` tag. --- src/liballoc/heap.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index 1d959ac5bf6dc..820f2d958d9a8 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -28,6 +28,7 @@ pub mod __core { extern "Rust" { #[allocator] fn __rust_alloc(size: usize, align: usize, err: *mut u8) -> *mut u8; + #[cold] fn __rust_oom(err: *const u8) -> !; fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize); fn __rust_usable_size(layout: *const u8, @@ -81,6 +82,7 @@ unsafe impl Alloc for Heap { } #[inline] + #[cold] fn oom(&mut self, err: AllocErr) -> ! { unsafe { __rust_oom(&err as *const AllocErr as *const u8)