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 9883ddf1 authored by qinsoon's avatar qinsoon
Browse files

reformat subcrates with new rustfmt.toml

parent af9e8261
...@@ -32,7 +32,7 @@ pub struct Instruction { ...@@ -32,7 +32,7 @@ pub struct Instruction {
/// This design makes it easy for the compiler to iterate through all the children /// This design makes it easy for the compiler to iterate through all the children
pub ops: Vec<P<TreeNode>>, pub ops: Vec<P<TreeNode>>,
/// used for pattern matching /// used for pattern matching
pub v: Instruction_, pub v: Instruction_
} }
// Instruction implements MuEntity // Instruction implements MuEntity
...@@ -44,7 +44,7 @@ impl Clone for Instruction { ...@@ -44,7 +44,7 @@ impl Clone for Instruction {
hdr: self.hdr.clone(), hdr: self.hdr.clone(),
value: self.value.clone(), value: self.value.clone(),
ops: self.ops.clone(), ops: self.ops.clone(),
v: self.v.clone(), v: self.v.clone()
} }
} }
} }
...@@ -118,7 +118,7 @@ impl Instruction { ...@@ -118,7 +118,7 @@ impl Instruction {
CCall { .. } | CCall { .. } |
SwapStack { .. } | SwapStack { .. } |
Switch { .. } | Switch { .. } |
ExnInstruction { .. } => true, ExnInstruction { .. } => true
} }
} }
...@@ -186,7 +186,7 @@ impl Instruction { ...@@ -186,7 +186,7 @@ impl Instruction {
CommonInst_Tr64ToTag(_) => false, CommonInst_Tr64ToTag(_) => false,
Move(_) => false, Move(_) => false,
PrintHex(_) => true, PrintHex(_) => true,
SetRetval(_) => true, SetRetval(_) => true
} }
} }
...@@ -252,7 +252,7 @@ impl Instruction { ...@@ -252,7 +252,7 @@ impl Instruction {
CommonInst_Tr64ToTag(_) | CommonInst_Tr64ToTag(_) |
Move(_) | Move(_) |
PrintHex(_) | PrintHex(_) |
SetRetval(_) => false, SetRetval(_) => false
} }
} }
...@@ -322,7 +322,7 @@ impl Instruction { ...@@ -322,7 +322,7 @@ impl Instruction {
CommonInst_Tr64ToTag(_) | CommonInst_Tr64ToTag(_) |
Move(_) | Move(_) |
PrintHex(_) | PrintHex(_) |
SetRetval(_) => None, SetRetval(_) => None
} }
} }
...@@ -365,14 +365,14 @@ pub enum Instruction_ { ...@@ -365,14 +365,14 @@ pub enum Instruction_ {
operation: ConvOp, operation: ConvOp,
from_ty: P<MuType>, from_ty: P<MuType>,
to_ty: P<MuType>, to_ty: P<MuType>,
operand: OpIndex, operand: OpIndex
}, },
/// a non-terminating Call instruction (the call does not have an exceptional branch) /// a non-terminating Call instruction (the call does not have an exceptional branch)
/// This instruction is not in the Mu spec, but is documented in the HOL formal spec /// This instruction is not in the Mu spec, but is documented in the HOL formal spec
ExprCall { ExprCall {
data: CallData, data: CallData,
is_abort: bool, // T to abort, F to rethrow is_abort: bool // T to abort, F to rethrow
}, },
/// a non-terminating CCall instruction (the call does not have an exceptional branch) /// a non-terminating CCall instruction (the call does not have an exceptional branch)
...@@ -383,7 +383,7 @@ pub enum Instruction_ { ...@@ -383,7 +383,7 @@ pub enum Instruction_ {
Load { Load {
is_ptr: bool, is_ptr: bool,
order: MemoryOrder, order: MemoryOrder,
mem_loc: OpIndex, mem_loc: OpIndex
}, },
/// store instruction /// store instruction
...@@ -391,7 +391,7 @@ pub enum Instruction_ { ...@@ -391,7 +391,7 @@ pub enum Instruction_ {
is_ptr: bool, is_ptr: bool,
order: MemoryOrder, order: MemoryOrder,
mem_loc: OpIndex, mem_loc: OpIndex,
value: OpIndex, value: OpIndex
}, },
/// compare and exchange, yields a pair value (oldvalue, boolean (T = success, F = failure)) /// compare and exchange, yields a pair value (oldvalue, boolean (T = success, F = failure))
...@@ -402,7 +402,7 @@ pub enum Instruction_ { ...@@ -402,7 +402,7 @@ pub enum Instruction_ {
fail_order: MemoryOrder, fail_order: MemoryOrder,
mem_loc: OpIndex, mem_loc: OpIndex,
expected_value: OpIndex, expected_value: OpIndex,
desired_value: OpIndex, desired_value: OpIndex
}, },
/// atomic read-modify-write, yields old memory value /// atomic read-modify-write, yields old memory value
...@@ -411,7 +411,7 @@ pub enum Instruction_ { ...@@ -411,7 +411,7 @@ pub enum Instruction_ {
order: MemoryOrder, order: MemoryOrder,
op: AtomicRMWOp, op: AtomicRMWOp,
mem_loc: OpIndex, mem_loc: OpIndex,
value: OpIndex, // operand for op value: OpIndex // operand for op
}, },
/// allocate an object (non hybrid type) in the heap, yields a reference of the type /// allocate an object (non hybrid type) in the heap, yields a reference of the type
...@@ -452,21 +452,21 @@ pub enum Instruction_ { ...@@ -452,21 +452,21 @@ pub enum Instruction_ {
GetFieldIRef { GetFieldIRef {
is_ptr: bool, is_ptr: bool,
base: OpIndex, // iref or uptr base: OpIndex, // iref or uptr
index: usize, // constant index: usize // constant
}, },
/// get internal reference of an element of an iref (or uptr) to an array /// get internal reference of an element of an iref (or uptr) to an array
GetElementIRef { GetElementIRef {
is_ptr: bool, is_ptr: bool,
base: OpIndex, base: OpIndex,
index: OpIndex, // can be constant or ssa var index: OpIndex // can be constant or ssa var
}, },
/// offset an iref (or uptr) (offset is an index) /// offset an iref (or uptr) (offset is an index)
ShiftIRef { ShiftIRef {
is_ptr: bool, is_ptr: bool,
base: OpIndex, base: OpIndex,
offset: OpIndex, offset: OpIndex
}, },
/// get internal reference to an element in hybrid var part /// get internal reference to an element in hybrid var part
...@@ -497,14 +497,14 @@ pub enum Instruction_ { ...@@ -497,14 +497,14 @@ pub enum Instruction_ {
cond: OpIndex, cond: OpIndex,
true_dest: Destination, true_dest: Destination,
false_dest: Destination, false_dest: Destination,
true_prob: f32, true_prob: f32
}, },
/// returns value1 if condition is true, otherwise returns value2 /// returns value1 if condition is true, otherwise returns value2
Select { Select {
cond: OpIndex, cond: OpIndex,
true_val: OpIndex, true_val: OpIndex,
false_val: OpIndex, false_val: OpIndex
}, },
/// a watchpoint /// a watchpoint
...@@ -516,26 +516,26 @@ pub enum Instruction_ { ...@@ -516,26 +516,26 @@ pub enum Instruction_ {
Watchpoint { Watchpoint {
id: Option<WPID>, id: Option<WPID>,
disable_dest: Option<Destination>, disable_dest: Option<Destination>,
resume: ResumptionData, resume: ResumptionData
}, },
/// a watchpoint branch, branch to different destinations based on enabled/disabled /// a watchpoint branch, branch to different destinations based on enabled/disabled
WPBranch { WPBranch {
wp: WPID, wp: WPID,
disable_dest: Destination, disable_dest: Destination,
enable_dest: Destination, enable_dest: Destination
}, },
/// a call instruction that may throw an exception /// a call instruction that may throw an exception
Call { Call {
data: CallData, data: CallData,
resume: ResumptionData, resume: ResumptionData
}, },
/// a ccall instruction that may throw an exception /// a ccall instruction that may throw an exception
CCall { CCall {
data: CallData, data: CallData,
resume: ResumptionData, resume: ResumptionData
}, },
/// swapstack. swap current Mu stack with the named Mu stack, /// swapstack. swap current Mu stack with the named Mu stack,
...@@ -544,21 +544,21 @@ pub enum Instruction_ { ...@@ -544,21 +544,21 @@ pub enum Instruction_ {
stack: OpIndex, stack: OpIndex,
is_exception: bool, is_exception: bool,
args: Vec<OpIndex>, args: Vec<OpIndex>,
resume: ResumptionData, resume: ResumptionData
}, },
/// a multiway branch /// a multiway branch
Switch { Switch {
cond: OpIndex, cond: OpIndex,
default: Destination, default: Destination,
branches: Vec<(OpIndex, Destination)>, branches: Vec<(OpIndex, Destination)>
}, },
/// a wrapper for any instruction that may throw an exception /// a wrapper for any instruction that may throw an exception
// This is not used at the moment // This is not used at the moment
ExnInstruction { ExnInstruction {
inner: Box<Instruction>, inner: Box<Instruction>,
resume: ResumptionData, resume: ResumptionData
}, },
/// common inst: get thread local /// common inst: get thread local
...@@ -599,7 +599,7 @@ pub enum Instruction_ { ...@@ -599,7 +599,7 @@ pub enum Instruction_ {
/// internal use: print op as hex value /// internal use: print op as hex value
PrintHex(OpIndex), PrintHex(OpIndex),
/// internal use: set return value for main /// internal use: set return value for main
SetRetval(OpIndex), SetRetval(OpIndex)
} }
impl Instruction_ { impl Instruction_ {
...@@ -614,7 +614,7 @@ impl Instruction_ { ...@@ -614,7 +614,7 @@ impl Instruction_ {
operation, operation,
ref from_ty, ref from_ty,
ref to_ty, ref to_ty,
operand, operand
} => format!("{:?} {} {} {}", operation, from_ty, to_ty, ops[operand]), } => format!("{:?} {} {} {}", operation, from_ty, to_ty, ops[operand]),
&Instruction_::ExprCall { ref data, is_abort } => { &Instruction_::ExprCall { ref data, is_abort } => {
let abort = select_value!(is_abort, "ABORT_ON_EXN", "RETHROW"); let abort = select_value!(is_abort, "ABORT_ON_EXN", "RETHROW");
...@@ -627,7 +627,7 @@ impl Instruction_ { ...@@ -627,7 +627,7 @@ impl Instruction_ {
&Instruction_::Load { &Instruction_::Load {
is_ptr, is_ptr,
mem_loc, mem_loc,
order, order
} => { } => {
let ptr = select_value!(is_ptr, "PTR", ""); let ptr = select_value!(is_ptr, "PTR", "");
format!("LOAD {} {:?} {}", ptr, order, ops[mem_loc]) format!("LOAD {} {:?} {}", ptr, order, ops[mem_loc])
...@@ -636,7 +636,7 @@ impl Instruction_ { ...@@ -636,7 +636,7 @@ impl Instruction_ {
value, value,
is_ptr, is_ptr,
mem_loc, mem_loc,
order, order
} => { } => {
let ptr = select_value!(is_ptr, "PTR", ""); let ptr = select_value!(is_ptr, "PTR", "");
format!("STORE {} {:?} {} {}", ptr, order, ops[mem_loc], ops[value]) format!("STORE {} {:?} {} {}", ptr, order, ops[mem_loc], ops[value])
...@@ -648,7 +648,7 @@ impl Instruction_ { ...@@ -648,7 +648,7 @@ impl Instruction_ {
fail_order, fail_order,
mem_loc, mem_loc,
expected_value, expected_value,
desired_value, desired_value
} => { } => {
let ptr = select_value!(is_ptr, "PTR", ""); let ptr = select_value!(is_ptr, "PTR", "");
let weak = select_value!(is_weak, "WEAK", ""); let weak = select_value!(is_weak, "WEAK", "");
...@@ -668,7 +668,7 @@ impl Instruction_ { ...@@ -668,7 +668,7 @@ impl Instruction_ {
order, order,
op, op,
mem_loc, mem_loc,
value, value
} => { } => {
let ptr = select_value!(is_ptr, "PTR", ""); let ptr = select_value!(is_ptr, "PTR", "");
format!( format!(
...@@ -700,7 +700,7 @@ impl Instruction_ { ...@@ -700,7 +700,7 @@ impl Instruction_ {
&Instruction_::GetFieldIRef { &Instruction_::GetFieldIRef {
is_ptr, is_ptr,
base, base,
index, index
} => { } => {
let ptr = select_value!(is_ptr, "PTR", ""); let ptr = select_value!(is_ptr, "PTR", "");
format!("GETFIELDIREF {} {} {}", ptr, ops[base], index) format!("GETFIELDIREF {} {} {}", ptr, ops[base], index)
...@@ -708,7 +708,7 @@ impl Instruction_ { ...@@ -708,7 +708,7 @@ impl Instruction_ {
&Instruction_::GetElementIRef { &Instruction_::GetElementIRef {
is_ptr, is_ptr,
base, base,
index, index
} => { } => {
let ptr = select_value!(is_ptr, "PTR", ""); let ptr = select_value!(is_ptr, "PTR", "");
format!("GETELEMENTIREF {} {} {}", ptr, ops[base], ops[index]) format!("GETELEMENTIREF {} {} {}", ptr, ops[base], ops[index])
...@@ -716,7 +716,7 @@ impl Instruction_ { ...@@ -716,7 +716,7 @@ impl Instruction_ {
&Instruction_::ShiftIRef { &Instruction_::ShiftIRef {
is_ptr, is_ptr,
base, base,
offset, offset
} => { } => {
let ptr = select_value!(is_ptr, "PTR", ""); let ptr = select_value!(is_ptr, "PTR", "");
format!("SHIFTIREF {} {} {}", ptr, ops[base], ops[offset]) format!("SHIFTIREF {} {} {}", ptr, ops[base], ops[offset])
...@@ -737,7 +737,7 @@ impl Instruction_ { ...@@ -737,7 +737,7 @@ impl Instruction_ {
cond, cond,
ref true_dest, ref true_dest,
ref false_dest, ref false_dest,
true_prob, true_prob
} => { } => {
format!( format!(
"BRANCH2 {} {}({}) {}", "BRANCH2 {} {}({}) {}",
...@@ -750,7 +750,7 @@ impl Instruction_ { ...@@ -750,7 +750,7 @@ impl Instruction_ {
&Instruction_::Select { &Instruction_::Select {
cond, cond,
true_val, true_val,
false_val, false_val
} => { } => {
format!( format!(
"SELECT if {} then {} else {}", "SELECT if {} then {} else {}",
...@@ -762,7 +762,7 @@ impl Instruction_ { ...@@ -762,7 +762,7 @@ impl Instruction_ {
&Instruction_::Watchpoint { &Instruction_::Watchpoint {
id, id,
ref disable_dest, ref disable_dest,
ref resume, ref resume
} => { } => {
match id { match id {
Some(id) => { Some(id) => {
...@@ -773,13 +773,13 @@ impl Instruction_ { ...@@ -773,13 +773,13 @@ impl Instruction_ {
resume.debug_str(ops) resume.debug_str(ops)
) )
} }
None => format!("TRAP {}", resume.debug_str(ops)), None => format!("TRAP {}", resume.debug_str(ops))
} }
} }
&Instruction_::WPBranch { &Instruction_::WPBranch {
wp, wp,
ref disable_dest, ref disable_dest,
ref enable_dest, ref enable_dest
} => { } => {
format!( format!(
"WPBRANCH {} {} {}", "WPBRANCH {} {} {}",
...@@ -790,17 +790,17 @@ impl Instruction_ { ...@@ -790,17 +790,17 @@ impl Instruction_ {
} }
&Instruction_::Call { &Instruction_::Call {
ref data, ref data,
ref resume, ref resume
} => format!("CALL {} {}", data.debug_str(ops), resume.debug_str(ops)), } => format!("CALL {} {}", data.debug_str(ops), resume.debug_str(ops)),
&Instruction_::CCall { &Instruction_::CCall {
ref data, ref data,
ref resume, ref resume
} => format!("CCALL {} {}", data.debug_str(ops), resume.debug_str(ops)), } => format!("CCALL {} {}", data.debug_str(ops), resume.debug_str(ops)),
&Instruction_::SwapStack { &Instruction_::SwapStack {
stack, stack,
is_exception, is_exception,
ref args, ref args,
ref resume, ref resume
} => { } => {
format!( format!(
"SWAPSTACK {} {} {} {}", "SWAPSTACK {} {} {} {}",
...@@ -813,7 +813,7 @@ impl Instruction_ { ...@@ -813,7 +813,7 @@ impl Instruction_ {
&Instruction_::Switch { &Instruction_::Switch {
cond, cond,
ref default, ref default,
ref branches, ref branches
} => { } => {
let mut ret = format!("SWITCH {} {} {{", ops[cond], default.debug_str(ops)); let mut ret = format!("SWITCH {} {} {{", ops[cond], default.debug_str(ops));
for i in 0..branches.len() { for i in 0..branches.len() {
...@@ -829,7 +829,7 @@ impl Instruction_ { ...@@ -829,7 +829,7 @@ impl Instruction_ {
} }
&Instruction_::ExnInstruction { &Instruction_::ExnInstruction {
ref inner, ref inner,
ref resume, ref resume
} => format!("{} {}", inner.debug_str(ops), resume.debug_str(ops)), } => format!("{} {}", inner.debug_str(ops), resume.debug_str(ops)),
// common inst // common inst
...@@ -864,7 +864,7 @@ impl Instruction_ { ...@@ -864,7 +864,7 @@ impl Instruction_ {
// print hex // print hex
&Instruction_::PrintHex(i) => format!("PRINTHEX {}", ops[i]), &Instruction_::PrintHex(i) => format!("PRINTHEX {}", ops[i]),
// set retval // set retval
&Instruction_::SetRetval(val) => format!("SETRETVAL {}", ops[val]), &Instruction_::SetRetval(val) => format!("SETRETVAL {}", ops[val])
} }
} }
} }
...@@ -879,7 +879,7 @@ pub struct BinOpStatus { ...@@ -879,7 +879,7 @@ pub struct BinOpStatus {
/// carry flag /// carry flag
pub flag_c: bool, pub flag_c: bool,
/// overflow flag /// overflow flag
pub flag_v: bool, pub flag_v: bool
} }
impl BinOpStatus { impl BinOpStatus {
...@@ -888,7 +888,7 @@ impl BinOpStatus { ...@@ -888,7 +888,7 @@ impl BinOpStatus {
flag_n: false, flag_n: false,
flag_z: false, flag_z: false,
flag_c: false, flag_c: false,
flag_v: false, flag_v: false
} }
} }
...@@ -897,7 +897,7 @@ impl BinOpStatus { ...@@ -897,7 +897,7 @@ impl BinOpStatus {
flag_n: true, flag_n: true,
flag_z: false, flag_z: false,
flag_c: false, flag_c: false,
flag_v: false, flag_v: false
} }
} }
...@@ -906,7 +906,7 @@ impl BinOpStatus { ...@@ -906,7 +906,7 @@ impl BinOpStatus {
flag_n: false, flag_n: false,
flag_z: true, flag_z: true,
flag_c: false, flag_c: false,
flag_v: false, flag_v: false
} }
} }
...@@ -915,7 +915,7 @@ impl BinOpStatus { ...@@ -915,7 +915,7 @@ impl BinOpStatus {
flag_n: false, flag_n: false,
flag_z: false, flag_z: false,
flag_c: true, flag_c: true,
flag_v: false, flag_v: false
} }
} }
...@@ -924,7 +924,7 @@ impl BinOpStatus { ...@@ -924,7 +924,7 @@ impl BinOpStatus {
flag_n: false, flag_n: false,
flag_z: false, flag_z: false,
flag_c: false, flag_c: false,
flag_v: true, flag_v: true
}