mod.rs 571 Bytes
Newer Older
qinsoon's avatar
qinsoon committed
1 2
mod malloc_list;
mod treadmill;
3

4 5 6 7 8
//pub use heap::freelist::malloc_list::FreeListSpace;
pub use heap::freelist::treadmill::FreeListSpace;

use std::sync::Arc;
use heap::gc;
qinsoon's avatar
qinsoon committed
9
use utils::Address;
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use heap::immix;

#[inline(never)]
pub fn alloc_large(size: usize, align: usize, mutator: &mut immix::ImmixMutatorLocal, space: Arc<FreeListSpace>) -> Address {
    loop {
        mutator.yieldpoint();

        let ret_addr = space.alloc(size, align);

        if ret_addr.is_zero() {
            gc::trigger_gc();
        } else {
            return ret_addr;
        }
    }
25
}