Skip to content

Commit fae60b3

Browse files
committed
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.
1 parent a83d2af commit fae60b3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/liballoc/heap.rs

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub mod __core {
2828
extern "Rust" {
2929
#[allocator]
3030
fn __rust_alloc(size: usize, align: usize, err: *mut u8) -> *mut u8;
31+
#[cold]
3132
fn __rust_oom(err: *const u8) -> !;
3233
fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize);
3334
fn __rust_usable_size(layout: *const u8,
@@ -81,6 +82,7 @@ unsafe impl Alloc for Heap {
8182
}
8283

8384
#[inline]
85+
#[cold]
8486
fn oom(&mut self, err: AllocErr) -> ! {
8587
unsafe {
8688
__rust_oom(&err as *const AllocErr as *const u8)

0 commit comments

Comments
 (0)