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.
This commit is contained in:
committed by
Ariel Ben-Yehuda
parent
acd0e40b86
commit
ece6c8434b
@@ -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<T: ?Sized>(ptr: *mut T) {
|
||||
pub(crate) unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
|
||||
let size = size_of_val(&*ptr);
|
||||
let align = min_align_of_val(&*ptr);
|
||||
// We do not allocate for Box<T> when T is ZST, so deallocation is also not necessary.
|
||||
|
||||
Reference in New Issue
Block a user