WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit d26902b9 authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano
Browse files

Made MuName changes work on aarch64

parent c2ce1a89
......@@ -105,7 +105,7 @@ impl ASMCode {
false
}
fn get_block_by_inst(&self, inst: usize) -> (&String, &ASMBlock) {
fn get_block_by_inst(&self, inst: usize) -> (&MuName, &ASMBlock) {
for (name, block) in self.blocks.iter() {
if inst >= block.start_inst && inst < block.end_inst {
return (name, block);
......@@ -693,7 +693,7 @@ impl MachineCode for ASMCode {
let asm = &mut self.code[inst];
let inst = String::from(asm.code.split_whitespace().next().unwrap());
asm.code = format!("{} {}", inst, mangle_name(String::from(new_dest)));
asm.code = format!("{} {}", inst, mangle_name(Arc::new(new_dest.to_string())));
asm.succs.clear();
asm.succs.push(succ);
}
......@@ -816,7 +816,7 @@ impl MachineCode for ASMCode {
trace!(
"#{}\t{:30}\t\tdefine: {:?}\tuses: {:?}\tpred: {:?}\tsucc: {:?}",
i,
demangle_text(self.code[i].code.clone()),
demangle_text(&self.code[i].code),
self.get_inst_reg_defines(i),
self.get_inst_reg_uses(i),
self.code[i].preds,
......@@ -825,26 +825,26 @@ impl MachineCode for ASMCode {
}
fn get_ir_block_livein(&self, block: &str) -> Option<&Vec<MuID>> {
match self.blocks.get(block) {
match self.blocks.get(&block.to_string()) {
Some(ref block) => Some(&block.livein),
None => None
}
}
fn get_ir_block_liveout(&self, block: &str) -> Option<&Vec<MuID>> {
match self.blocks.get(block) {
match self.blocks.get(&block.to_string()) {
Some(ref block) => Some(&block.liveout),
None => None
}
}
fn set_ir_block_livein(&mut self, block: &str, set: Vec<MuID>) {
let block = self.blocks.get_mut(block).unwrap();
let block = self.blocks.get_mut(&block.to_string()).unwrap();
block.livein = set;
}
fn set_ir_block_liveout(&mut self, block: &str, set: Vec<MuID>) {
let block = self.blocks.get_mut(block).unwrap();
let block = self.blocks.get_mut(&block.to_string()).unwrap();
block.liveout = set;
}
......@@ -857,7 +857,7 @@ impl MachineCode for ASMCode {
}
fn get_block_range(&self, block: &str) -> Option<ops::Range<usize>> {
match self.blocks.get(block) {
match self.blocks.get(&block.to_string()) {
Some(ref block) => Some(block.start_inst..block.end_inst),
None => None
}
......@@ -1000,10 +1000,10 @@ pub struct ASMCodeGen {
const REG_PLACEHOLDER_LEN: usize = 5;
lazy_static! {
pub static ref REG_PLACEHOLDER : String = {
pub static ref REG_PLACEHOLDER : MuName = {
let blank_spaces = [' ' as u8; REG_PLACEHOLDER_LEN];
format!("{}", str::from_utf8(&blank_spaces).unwrap())
Arc::new(format!("{}", str::from_utf8(&blank_spaces).unwrap()))
};
}
......@@ -1033,7 +1033,7 @@ impl ASMCodeGen {
}
fn add_asm_symbolic(&mut self, code: String) {
trace_emit!("{}", demangle_text(code.clone()));
trace_emit!("{}", demangle_text(&code));
self.cur_mut().code.push(ASMInst::symbolic(code));
}
......@@ -1098,7 +1098,7 @@ impl ASMCodeGen {
target: ASMBranchTarget,
spill_info: Option<SpillMemInfo>
) {
trace!("asm: {}", demangle_text(code.clone()));
trace!("asm: {}", demangle_text(&code));
trace!(" defines: {:?}", defines);
trace!(" uses: {:?}", uses);
trace!(" target: {:?}", target);
......@@ -1274,7 +1274,7 @@ impl ASMCodeGen {
format!("{}", op.name())
} else {
// virtual register, use place holder
REG_PLACEHOLDER.clone()
(**REG_PLACEHOLDER).clone()
}
}
......@@ -2119,7 +2119,7 @@ impl ASMCodeGen {
fn internal_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
code: String,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -2192,8 +2192,8 @@ impl CodeGenerator for ASMCodeGen {
self.add_asm_symbolic(format!(".type {}, @function", func_symbol.clone()));
self.add_asm_symbolic(format!("{}:", func_symbol.clone()));
if is_valid_c_identifier(&func_name) {
self.add_asm_symbolic(directive_globl(func_name.clone()));
self.add_asm_symbolic(directive_equiv(func_name.clone(), func_symbol.clone()));
self.add_asm_symbolic(directive_globl((*func_name).clone()));
self.add_asm_symbolic(directive_equiv((*func_name).clone(), func_symbol.clone()));
}
ValueLocation::Relocatable(RegGroup::GPR, func_name)
......@@ -2204,9 +2204,9 @@ impl CodeGenerator for ASMCodeGen {
func_name: MuName
) -> (Box<MachineCode + Sync + Send>, ValueLocation) {
let func_end = {
let mut symbol = func_name.clone();
let mut symbol = (*func_name).clone();
symbol.push_str(":end");
symbol
Arc::new(symbol)
};
let func_symbol = mangle_name(func_name.clone());
let func_end_sym = mangle_name(func_end.clone());
......@@ -2229,8 +2229,8 @@ impl CodeGenerator for ASMCodeGen {
fn start_code_sequence(&mut self) {
self.cur = Some(Box::new(ASMCode {
name: "snippet".to_string(),
entry: "none".to_string(),
name: Arc::new("snippet".to_string()),
entry: Arc::new("none".to_string()),
code: vec![],
blocks: linked_hashmap!{},
frame_size_patchpoints: vec![]
......@@ -2401,7 +2401,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_bl(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -2428,7 +2428,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_blr(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: Reg,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -2461,7 +2461,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_b_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -2516,7 +2516,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_br_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: Reg,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -3444,7 +3444,7 @@ pub fn emit_code(fv: &mut MuFunctionVersion, vm: &VM) {
{
let mut demangled_path = path::PathBuf::new();
demangled_path.push(&vm.vm_options.flag_aot_emit_dir);
demangled_path.push(*func.name() + ".demangled.S");
demangled_path.push((*func.name()).clone() + ".demangled.S");
let mut demangled_file = match File::create(demangled_path.as_path()) {
Err(why) => {
......@@ -3468,7 +3468,7 @@ pub fn emit_code(fv: &mut MuFunctionVersion, vm: &VM) {
};
let mut f = String::new();
mangled_file.read_to_string(&mut f).unwrap();
let d = demangle_text(f);
let d = demangle_text(&f);
match demangled_file.write_all(d.as_bytes()) {
Err(why) => {
panic!(
......@@ -3578,7 +3578,7 @@ use std::collections::HashMap;
pub fn emit_context_with_reloc(
vm: &VM,
symbols: HashMap<Address, MuName>,
fields: HashMap<Address, String>
fields: HashMap<Address, MuName>
) {
use std::path;
use std::io::prelude::*;
......@@ -3655,6 +3655,7 @@ pub fn emit_context_with_reloc(
writeln!(file, "{}:", global_cell_name.clone()).unwrap();
if is_valid_c_identifier(&demangled_name) {
let demangled_name = (*demangled_name).clone();
writeln!(file, "\t{}", directive_globl(demangled_name.clone())).unwrap();
writeln!(
file,
......
......@@ -120,7 +120,7 @@ pub trait CodeGenerator {
// Calls
fn emit_bl(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -129,7 +129,7 @@ pub trait CodeGenerator {
) -> Option<ValueLocation>;
fn emit_blr(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: Reg,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -141,7 +141,7 @@ pub trait CodeGenerator {
fn emit_br(&mut self, dest_address: Reg);
fn emit_b_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -151,7 +151,7 @@ pub trait CodeGenerator {
) -> Option<ValueLocation>;
fn emit_br_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: Reg,
pe: Option<MuName>,
args: Vec<P<Value>>,
......
......@@ -88,7 +88,7 @@ impl<'a> InstructionSelection {
combined_return_types: HashMap::new(),
current_return_type: None,
current_fv_id: 0,
current_fv_name: String::new(),
current_fv_name: Arc::new(String::new()),
current_callsite_id: 0,
current_frame: None,
current_block: None,
......@@ -1807,7 +1807,7 @@ impl<'a> InstructionSelection {
// Call muentry_throw_exception
let callsite = self.backend.emit_bl(
Some(callsite_label),
"muentry_throw_exception".to_string(),
entrypoints::THROW_EXCEPTION.aot.to_relocatable(),
None,
vec![X0.clone()],
CALLER_SAVED_REGS.to_vec(),
......@@ -3807,7 +3807,7 @@ impl<'a> InstructionSelection {
} else {
//declare_type(&self, entity: MuEntityHeader, ty: MuType_)
let id = new_internal_id();
let name = format!("return_type:#{}", id);
let name = Arc::new(format!("return_type:#{}", id));
let header = MuEntityHeader::named(new_internal_id(), name.clone());
vm.declare_type(header, MuType_::mustruct(name, sig.ret_tys.to_vec()))
},
......@@ -4899,7 +4899,7 @@ impl<'a> InstructionSelection {
) {
trace!("ISAAC: sig[{}] args ({:?})", sig, args);
let prologue_block = format!("{}:{}", self.current_fv_name, PROLOGUE_BLOCK_NAME);
let prologue_block = Arc::new(format!("{}:{}", self.current_fv_name, PROLOGUE_BLOCK_NAME));
self.start_block(prologue_block);
// Push the frame pointer and link register onto the stack
......@@ -5933,7 +5933,7 @@ impl<'a> InstructionSelection {
layout[index] as i64
}
fn new_callsite_label(&mut self, cur_node: Option<&TreeNode>) -> String {
fn new_callsite_label(&mut self, cur_node: Option<&TreeNode>) -> MuName {
let ret = {
if cur_node.is_some() {
make_block_name(
......@@ -5941,11 +5941,11 @@ impl<'a> InstructionSelection {
format!("callsite_{}", self.current_callsite_id).as_str()
)
} else {
format!(
Arc::new(format!(
"{}:callsite_{}",
self.current_fv_name,
self.current_callsite_id
)
))
}
};
self.current_callsite_id += 1;
......
......@@ -2392,9 +2392,9 @@ pub fn emit_addr_sym(backend: &mut CodeGenerator, dest: &P<Value>, src: &P<Value
hdr: MuEntityHeader::unnamed(vm.next_id()),
ty: UINT64_TYPE.clone(),
v: Value_::Constant(Constant::ExternSym(if is_native {
format!("/*C*/:got_lo12:{}", label)
Arc::new(format!("/*C*/:got_lo12:{}", label))
} else {
format!(":got_lo12:{}", mangle_name(label.clone()))
Arc::new(format!(":got_lo12:{}", mangle_name(label.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