Commit ca802615 authored by qinsoon's avatar qinsoon

[wip] GetFieldIRef on hybrid

parent 8da4a884
......@@ -292,6 +292,19 @@ impl MuType_ {
MuType_::Hybrid(tag)
}
pub fn hybrid_put(tag: HybridTag, mut fix_tys: Vec<P<MuType>>, var_ty: P<MuType>) {
let mut map_guard = HYBRID_TAG_MAP.write().unwrap();
match map_guard.get_mut(&tag) {
Some(hybrid_ty_) => {
hybrid_ty_.fix_tys.clear();
hybrid_ty_.fix_tys.append(&mut fix_tys);
hybrid_ty_.var_ty = var_ty;
},
None => panic!("call hybrid_empty() to create an empty struct before hybrid_put()")
}
}
pub fn hybrid(tag: HybridTag, fix_tys: Vec<P<MuType>>, var_ty: P<MuType>) -> MuType_ {
let hybrid_ty_ = HybridType_{fix_tys: fix_tys, var_ty: var_ty};
......
......@@ -870,7 +870,7 @@ impl ASMCodeGen {
if cfg!(debug_assertions) {
match op.v {
Value_::Memory(_) => {},
_ => panic!("expecting register op")
_ => panic!("expecting memory op")
}
}
......@@ -890,7 +890,7 @@ impl ASMCodeGen {
match offset.v {
Value_::SSAVar(id) => {
// temp as offset
let (str, id, loc) = self.prepare_reg(offset, 0);
let (str, id, loc) = self.prepare_reg(offset, loc_cursor);
result_str.push_str(&str);
ids.push(id);
......
......@@ -133,12 +133,14 @@ pub extern fn alloc(mutator: *mut ImmixMutatorLocal, size: usize, align: usize)
#[no_mangle]
#[inline(never)]
pub extern fn muentry_alloc_slow(mutator: *mut ImmixMutatorLocal, size: usize, align: usize) -> ObjectReference {
trace!("muentry_alloc_slow(mutator: {:?}, size: {}, align: {})", mutator, size, align);
let ret = unsafe {mutator.as_mut().unwrap()}.try_alloc_from_local(size, align);
unsafe {ret.to_object_reference()}
}
#[no_mangle]
pub extern fn alloc_large(mutator: *mut ImmixMutatorLocal, size: usize, align: usize) -> ObjectReference {
pub extern fn muentry_alloc_large(mutator: *mut ImmixMutatorLocal, size: usize, align: usize) -> ObjectReference {
trace!("muentry_alloc_large(mutator: {:?}, size: {}, align: {})", mutator, size, align);
let ret = freelist::alloc_large(size, align, unsafe {mutator.as_mut().unwrap()}, MY_GC.read().unwrap().as_ref().unwrap().lo_space.clone());
unsafe {ret.to_object_reference()}
}
\ No newline at end of file
......@@ -46,11 +46,22 @@ lazy_static! {
sig: P(MuFuncSig {
hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
ret_tys: vec![ADDRESS_TYPE.clone()],
arg_tys: vec![UINT64_TYPE.clone(), UINT64_TYPE.clone()]
arg_tys: vec![ADDRESS_TYPE.clone(), UINT64_TYPE.clone(), UINT64_TYPE.clone()]
}),
aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_alloc_slow")),
jit: RwLock::new(None),
};
// impl/decl: gc/lib.rs
pub static ref ALLOC_LARGE : RuntimeEntrypoint = RuntimeEntrypoint {
sig: P(MuFuncSig {
hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
ret_tys: vec![ADDRESS_TYPE.clone()],
arg_tys: vec![ADDRESS_TYPE.clone(), UINT64_TYPE.clone(), UINT64_TYPE.clone()]
}),
aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_alloc_large")),
jit: RwLock::new(None)
};
// impl/decl: exception.rs
pub static ref THROW_EXCEPTION : RuntimeEntrypoint = RuntimeEntrypoint {
......
This diff is collapsed.
......@@ -44,7 +44,7 @@ fn test_exhaust_alloc_large() {
for _ in 0..WORK_LOAD {
mutator.yieldpoint();
let res = mm::alloc_large(&mut mutator, LARGE_OBJECT_SIZE, OBJECT_ALIGN);
let res = mm::muentry_alloc_large(&mut mutator, LARGE_OBJECT_SIZE, OBJECT_ALIGN);
}
mutator.destroy();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment