Commit 22c3a1b0 authored by qinsoon's avatar qinsoon

fix

parent 896af8f0
Pipeline #1306 passed with stages
in 50 minutes and 23 seconds
......@@ -1714,7 +1714,7 @@ impl<'a> InstructionSelection {
}
Instruction_::New(ref ty) => {
trace!("instsel on NEW");
trace!("instsel on NEW: {}", ty.print_details());
assert!(!ty.is_hybrid());
let ty_info = vm.get_backend_type_info(ty.id());
......@@ -1737,7 +1737,7 @@ impl<'a> InstructionSelection {
}
Instruction_::NewHybrid(ref ty, var_len) => {
trace!("instsel on NEWHYBRID");
trace!("instsel on NEWHYBRID: {}", ty.print_details());
assert!(ty.is_hybrid());
let ty_info = vm.get_backend_type_info(ty.id());
......@@ -3536,7 +3536,7 @@ impl<'a> InstructionSelection {
vm
);
// init object
if size < mm::MAX_SMALL_OBJECT {
if size <= mm::MAX_SMALL_OBJECT {
let tmp_encode =
self.make_int_const(encode.small().as_u64(), UINT16_TYPE.clone(), vm);
self.emit_runtime_entry(
......
......@@ -252,6 +252,8 @@ impl BackendType {
_ => unimplemented!()
}
}
// void
MuType_::Void => TypeEncode::short_noref(MINIMAL_ALIGNMENT, 1),
// ref
MuType_::Ref(_) | MuType_::IRef(_) => TypeEncode::short_ref(),
// weakref
......@@ -347,6 +349,11 @@ impl BackendType {
res.push(WordType::NonRef);
}
}
MuType_::Void => {
if pointer_aligned {
res.push(WordType::NonRef);
}
}
MuType_::Ref(_) | MuType_::IRef(_) => {
debug_assert!(pointer_aligned);
res.push(WordType::Ref);
......@@ -575,10 +582,10 @@ impl BackendType {
ret
}
// void
// void - one byte
MuType_::Void => BackendType {
ty: ty.clone(),
size: 0,
size: 1,
alignment: 1,
struct_layout: None,
elem_size: None,
......
......@@ -92,13 +92,15 @@ impl GlobalTypeTable {
pub fn cleanup() {
// unmap the table
let mmap_start = GlobalTypeTable::table_meta().mmap_start;
let mmap_size = GlobalTypeTable::table_meta().mmap_size;
munmap(mmap_start, mmap_size);
// set pointers to zero
GLOBAL_TYPE_TABLE_PTR.store(0, Ordering::Relaxed);
GLOBAL_TYPE_TABLE_META.store(0, Ordering::Relaxed);
if GLOBAL_TYPE_TABLE_META.load(Ordering::SeqCst) != 0 {
let mmap_start = GlobalTypeTable::table_meta().mmap_start;
let mmap_size = GlobalTypeTable::table_meta().mmap_size;
munmap(mmap_start, mmap_size);
// set pointers to zero
GLOBAL_TYPE_TABLE_PTR.store(0, Ordering::Relaxed);
GLOBAL_TYPE_TABLE_META.store(0, Ordering::Relaxed);
}
}
#[inline(always)]
......
......@@ -183,6 +183,7 @@ impl Eq for ShortTypeEncode {}
use std::hash::*;
impl Hash for ShortTypeEncode {
fn hash<H: Hasher>(&self, state: &mut H) {
self.align.hash(state);
self.fix_len.hash(state);
self.fix_ty.hash(state);
self.var_len.hash(state);
......
......@@ -54,6 +54,13 @@ pub fn gen_object_encode(backend_ty: &BackendType, size: ByteSize, vm: &VM) -> O
}
};
debug!(
"ENCODE: gen_object_encode: {:?}, size: {}",
backend_ty,
size
);
debug!("ENCODE: gc_ty: {}, full_gc_ty: {}", gc_tyid, full_tyid);
gen_object_encode_internal(is_hybrid, gc_tyid, full_tyid, size, vm)
}
......
......@@ -942,7 +942,7 @@ impl<'a> VM {
if !type_map.contains_key(&gc_type) {
let id = match gc_type {
TypeEncode::Short(ref enc) => {
if resolved.size < MAX_SMALL_OBJECT {
if resolved.size <= MAX_SMALL_OBJECT {
GlobalTypeTable::insert_small_entry(enc.clone())
} else {
GlobalTypeTable::insert_large_entry(enc.clone())
......@@ -950,6 +950,7 @@ impl<'a> VM {
}
TypeEncode::Full(ref enc) => GlobalTypeTable::insert_full_entry(enc.clone())
};
debug!("ENCODE: {} = {:?}", id, gc_type);
type_map.insert(gc_type.clone(), id);
id_map.insert(id, gc_type);
}
......@@ -960,6 +961,7 @@ impl<'a> VM {
Some(ref enc) => {
if !type_map.contains_key(enc) {
let id = GlobalTypeTable::insert_full_entry(enc.as_full().clone());
debug!("ENCODE: (hybrid full) {} = {:?}", id, enc);
type_map.insert(enc.clone(), id);
id_map.insert(id, enc.clone());
}
......
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