Commit e31c8105 authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano

Fixed aarch64 so I can run mu-perf-benchmarks (also added a REF_VOID_TYPE)

parent 870d7c8d
...@@ -63,6 +63,10 @@ lazy_static! { ...@@ -63,6 +63,10 @@ lazy_static! {
MuType::new(new_internal_id(), MuType_::void()) MuType::new(new_internal_id(), MuType_::void())
); );
pub static ref REF_VOID_TYPE : P<MuType> = P(
MuType::new(new_internal_id(), MuType_::muref(VOID_TYPE.clone()))
);
pub static ref INTERNAL_TYPES : Vec<P<MuType>> = vec![ pub static ref INTERNAL_TYPES : Vec<P<MuType>> = vec![
ADDRESS_TYPE.clone(), ADDRESS_TYPE.clone(),
UINT1_TYPE.clone(), UINT1_TYPE.clone(),
...@@ -74,7 +78,8 @@ lazy_static! { ...@@ -74,7 +78,8 @@ lazy_static! {
FLOAT_TYPE.clone(), FLOAT_TYPE.clone(),
DOUBLE_TYPE.clone(), DOUBLE_TYPE.clone(),
FLOAT_TYPE.clone(), FLOAT_TYPE.clone(),
VOID_TYPE.clone() VOID_TYPE.clone(),
REF_VOID_TYPE.clone(),
]; ];
} }
......
...@@ -3879,6 +3879,17 @@ impl <'a> InstructionSelection { ...@@ -3879,6 +3879,17 @@ impl <'a> InstructionSelection {
self.emit_shift_ref(&ops[base], &ops[index], element_size, f_content, f_context, vm) self.emit_shift_ref(&ops[base], &ops[index], element_size, f_content, f_context, vm)
} }
Instruction_::ConvOp{operation, operand, ..} => {
match operation {
op::ConvOp::REFCAST | op::ConvOp::PTRCAST => {
let ref ref_op = ops[operand];
// TODO: Inline the input (i.e. discard the PTR cast)
let temp = self.emit_ireg(ref_op, f_content, f_context, vm);
make_memory_location_base_offset(&temp, 0, vm)
}
_ => panic!("Not a memory conversion")
}
}
_ => panic!("Not a memory reference instruction") _ => panic!("Not a memory reference instruction")
} }
}, },
......
...@@ -1558,6 +1558,12 @@ pub fn emit_mov_u64(backend: &mut CodeGenerator, dest: &P<Value>, val: u64) ...@@ -1558,6 +1558,12 @@ pub fn emit_mov_u64(backend: &mut CodeGenerator, dest: &P<Value>, val: u64)
// Have to use more than one instruciton // Have to use more than one instruciton
} else { } else {
// Mask val so the higher (unused) bits are cleared
let val = if n < 64 {
val & (1 << n) - 1
} else {
val
};
// Note n > 16, so there are at least two halfwords in n // Note n > 16, so there are at least two halfwords in n
// How many halfowrds are zero or one // How many halfowrds are zero or one
...@@ -1575,7 +1581,7 @@ pub fn emit_mov_u64(backend: &mut CodeGenerator, dest: &P<Value>, val: u64) ...@@ -1575,7 +1581,7 @@ pub fn emit_mov_u64(backend: &mut CodeGenerator, dest: &P<Value>, val: u64)
let (pv0, pv1, pv2, pv3) = split_aarch64_imm_u64(val); let (pv0, pv1, pv2, pv3) = split_aarch64_imm_u64(val);
let mut movzn = false; // whether a movz/movn has been emmited yet let mut movzn = false; // whether a movz/movn has been emmited yet
if n_ones > n_zeros { if false /*n_ones > n_zeros*/ { // TODO: Fix this??
// It will take less instructions to use MOVN // It will take less instructions to use MOVN
// MOVN(dest, v, n) will set dest = !(v << n) // MOVN(dest, v, n) will set dest = !(v << n)
......
...@@ -542,7 +542,6 @@ impl <'a> VM { ...@@ -542,7 +542,6 @@ impl <'a> VM {
} else { } else {
let mut new_map = HashMap::new(); let mut new_map = HashMap::new();
new_map.insert(callsite, catch); new_map.insert(callsite, catch);
table.insert(fv, new_map); table.insert(fv, new_map);
}; };
} }
...@@ -1680,21 +1679,12 @@ impl <'a> VM { ...@@ -1680,21 +1679,12 @@ impl <'a> VM {
let opnd = value.v.as_tr64(); let opnd = value.v.as_tr64();
self.new_handle(APIHandle { self.new_handle(APIHandle {
id: handle_id, id: handle_id,
v : APIHandleValue::Ref( v : APIHandleValue::Ref(types::REF_VOID_TYPE.clone(),
// FIXME: Shouldn't I be able to refer to an existing ref<void> type??
P(
MuType::new(new_internal_id(), MuType_::muref(
P(
MuType::new(new_internal_id(), MuType_::void())
)
)
)
),
unsafe { Address::from_raw( unsafe { Address::from_raw(
((opnd & 0x7ffffffffff8u64) | ((opnd & 0x7ffffffffff8u64) |
(((!(((opnd & 0x8000000000000000u64) << 1) - 1)) >> 17) & (((!(((opnd & 0x8000000000000000u64) << 1) - 1)) >> 17) &
0xffff800000000000u64)) as usize 0xffff800000000000u64)) as usize
) } ) ) })
}) })
} }
......
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