GitLab will continue to be upgraded from 11.4.5-ce.0 on November 25th 2019 at 4.00pm (AEDT) to 5.00pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available.

mm.rs 801 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
extern crate gc;

pub use self::gc::*;

use utils::ByteSize;
use utils::ObjectReference;
use ast::ir::*;
use ast::ptr::*;
use compiler::backend::RegGroup;
use vm::VM;
use runtime::ValueLocation;
use runtime::thread::MuThread;

fn allocate(size: ByteSize, align: ByteSize) -> ObjectReference {
    let allocator = (&mut MuThread::current_mut().allocator) as *mut Mutator;

    if size > LARGE_OBJECT_THRESHOLD {
        muentry_alloc_large(allocator, size, align)
    } else {
        alloc(allocator, size, align)
    }
}

pub fn allocate_value(value: P<Value>, vm: &VM) -> ValueLocation {
    let tyid = value.ty.id();
    let backend_ty = vm.get_backend_type_info(tyid);

    let addr = allocate(backend_ty.size, backend_ty.alignment).to_address();

    ValueLocation::Direct(RegGroup::GPR, addr)
31
}