about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-08-11 15:59:11 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-08-11 15:59:11 -0700
commitfae60b36cb48b1d5827eaaee656f0ff1a6cc6894 (patch)
treefd98a7fe0e6488e434922b62333b0e9d2a3e73f8 /src/liballoc
parenta83d2afbba772f474872aacc6c21f2b5270fc517 (diff)
downloadrust-fae60b36cb48b1d5827eaaee656f0ff1a6cc6894.tar.gz
rust-fae60b36cb48b1d5827eaaee656f0ff1a6cc6894.zip
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.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/heap.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs
index 1d959ac5bf6..820f2d958d9 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)