From ece6c8434bc4eba1d3addfa4d5900264e55395fc Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Thu, 20 Apr 2017 15:08:41 +0300 Subject: cache attributes of items from foreign crates this avoids parsing item attributes on each call to `item_attrs`, which takes off 33% (!) of translation time and 50% (!) of trans-item collection time. --- src/liballoc/heap.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/liballoc/heap.rs') diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index 08a0b2a6d00..056af13016c 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -16,7 +16,6 @@ issue = "27700")] use core::{isize, usize}; -#[cfg(not(test))] use core::intrinsics::{min_align_of_val, size_of_val}; #[allow(improper_ctypes)] @@ -158,10 +157,9 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 { } } -#[cfg(not(test))] -#[lang = "box_free"] +#[cfg_attr(not(test), lang = "box_free")] #[inline] -unsafe fn box_free(ptr: *mut T) { +pub(crate) unsafe fn box_free(ptr: *mut T) { let size = size_of_val(&*ptr); let align = min_align_of_val(&*ptr); // We do not allocate for Box when T is ZST, so deallocation is also not necessary. -- cgit 1.4.1-3-g733a5