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
Pipeline #611 passed with stages
in 41 minutes and 59 seconds
......@@ -62,7 +62,11 @@ lazy_static! {
pub static ref VOID_TYPE : P<MuType> = P(
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![
ADDRESS_TYPE.clone(),
UINT1_TYPE.clone(),
......@@ -74,7 +78,8 @@ lazy_static! {
FLOAT_TYPE.clone(),
DOUBLE_TYPE.clone(),
FLOAT_TYPE.clone(),
VOID_TYPE.clone()
VOID_TYPE.clone(),
REF_VOID_TYPE.clone(),
];
}
......
// Copyright 2017 The Australian National University
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2017 The Australian National University
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![warn(unused_imports)]
#![warn(unreachable_code)]
......@@ -3879,6 +3879,17 @@ impl <'a> InstructionSelection {
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")
}
},
......
......@@ -1558,6 +1558,12 @@ pub fn emit_mov_u64(backend: &mut CodeGenerator, dest: &P<Value>, val: u64)
// Have to use more than one instruciton
} 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
// How many halfowrds are zero or one
......@@ -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 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
// MOVN(dest, v, n) will set dest = !(v << n)
......
......@@ -542,7 +542,6 @@ impl <'a> VM {
} else {
let mut new_map = HashMap::new();
new_map.insert(callsite, catch);
table.insert(fv, new_map);
};
}
......@@ -1680,21 +1679,12 @@ impl <'a> VM {
let opnd = value.v.as_tr64();
self.new_handle(APIHandle {
id: handle_id,
v : APIHandleValue::Ref(
// 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(
((opnd & 0x7ffffffffff8u64) |
(((!(((opnd & 0x8000000000000000u64) << 1) - 1)) >> 17) &
v : APIHandleValue::Ref(types::REF_VOID_TYPE.clone(),
unsafe { Address::from_raw(
((opnd & 0x7ffffffffff8u64) |
(((!(((opnd & 0x8000000000000000u64) << 1) - 1)) >> 17) &
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