mod.rs 612 Bytes
Newer Older
1 2
mod malloc_list;
mod treadmill;
3

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
//pub use heap::freelist::malloc_list::FreeListSpace;
pub use heap::freelist::treadmill::FreeListSpace;

use std::sync::Arc;
use std::sync::RwLock;
use heap::gc;
use utils::{Address, ObjectReference};
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;
        }
    }
}