Skip to content

Commit 14c93b4

Browse files
Merge #45
45: Inline allocation calls r=ltratt a=jacob-hughes Co-authored-by: Jake Hughes <[email protected]>
2 parents 434cb2f + db8dd7c commit 14c93b4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/allocator.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,20 @@ unsafe impl GlobalAlloc for GcAllocator {
2929
}
3030

3131
#[cfg(feature = "rustgc")]
32+
#[inline]
3233
unsafe fn alloc_precise(&self, layout: Layout, bitmap: usize, bitmap_size: usize) -> *mut u8 {
3334
let gc_descr = boehm::GC_make_descriptor(&bitmap, bitmap_size);
3435
boehm::GC_malloc_explicitly_typed(layout.size(), gc_descr) as *mut u8
3536
}
3637

3738
#[cfg(feature = "rustgc")]
39+
#[inline]
3840
fn alloc_conservative(&self, layout: Layout) -> *mut u8 {
3941
unsafe { boehm::GC_malloc(layout.size()) as *mut u8 }
4042
}
4143

4244
#[cfg(feature = "rustgc")]
45+
#[inline]
4346
unsafe fn alloc_untraceable(&self, layout: Layout) -> *mut u8 {
4447
boehm::GC_malloc_atomic(layout.size()) as *mut u8
4548
}
@@ -57,6 +60,7 @@ unsafe impl Allocator for GcAllocator {
5760
unsafe fn deallocate(&self, _: NonNull<u8>, _: Layout) {}
5861

5962
#[cfg(feature = "rustgc")]
63+
#[inline]
6064
fn alloc_untraceable(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
6165
unsafe {
6266
let ptr = boehm::GC_malloc_atomic(layout.size()) as *mut u8;
@@ -66,6 +70,7 @@ unsafe impl Allocator for GcAllocator {
6670
}
6771

6872
#[cfg(feature = "rustgc")]
73+
#[inline]
6974
fn alloc_conservative(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
7075
unsafe {
7176
let ptr = boehm::GC_malloc(layout.size()) as *mut u8;
@@ -75,6 +80,7 @@ unsafe impl Allocator for GcAllocator {
7580
}
7681

7782
#[cfg(feature = "rustgc")]
83+
#[inline]
7884
fn alloc_precise(
7985
&self,
8086
layout: Layout,

0 commit comments

Comments
 (0)