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.6% of users enabled 2FA.

Commit 06d5ccdc authored by qinsoon's avatar qinsoon
Browse files

more changes from formal specs

parent ac942157
......@@ -101,10 +101,31 @@ pub enum Constant {
pub enum Expression {
BinOp(BinOp, P<Value>, P<Value>),
CmpOp(CmpOp, P<Value>, P<Value>),
// yields the constant value
Constant(P<Constant>),
// memory operations
// yields a tuple of results from the call
ExprCall{
data: CallData,
is_abort: bool, // T to abort, F to rethrow
},
// yields the memory value
Load{
is_iref: bool,
mem_loc: P<Value>,
order: MemoryOrder
},
// yields nothing
Store{
is_iref: bool,
mem_loc: P<Value>,
order: MemoryOrder
},
// yields pair (oldvalue, boolean (T = success, F = failure))
CmpXchg{
is_iref: bool, // T for iref, F for ptr
is_strong: bool,
......@@ -115,6 +136,7 @@ pub enum Expression {
desired_value: P<Value>
},
// yields old memory value
AtomicRMW{
is_iref: bool, // T for iref, F for ptr
order: MemoryOrder,
......@@ -123,39 +145,70 @@ pub enum Expression {
value: P<Value> // operand for op
},
Fence(MemoryOrder),
// allocation operations
// yields a reference of the type
New(P<MuType_>),
// yields an iref of the type
AllocA(P<MuType_>),
// yields ref
NewHybrid{ // hybrid type, var part length
ty: P<MuType_>,
var_len: P<Value>
},
// yields iref
AllocAHybrid{
ty: P<MuType_>,
var_len: P<Value>
},
// yields stack ref
NewStack{
func: P<Value>
},
// yields thread reference
NewThread{
stack: P<Value>,
args: Vec<P<Value>>
},
NewThreadExn{ // NewThreadExn SSAVar (* stack id *) SSAVar (* exception value *) ???
// yields thread reference (thread resumes with exceptional value)
NewThreadExn{
stack: P<Value>,
exn: P<Value>
},
PushFrame{
stack: P<Value>,
func: P<Value>
// yields frame cursor
NewFrameCursor(P<Value>), // stack
GetIRef(P<Value>),
GetFieldIRef{
base: P<Value>, // iref or ptr
index: P<Constant>
},
PopFrame{
stack: P<Value>
}
GetElementIRef{
base: P<Value>,
index: P<Value>
},
ShiftIRef{
base: P<Value>,
offset: P<Value>
},
GetVarPartIRef(P<Value>),
// PushFrame{
// stack: P<Value>,
// func: P<Value>
// },
// PopFrame{
// stack: P<Value>
// }
}
pub enum Instruction {
......@@ -163,18 +216,8 @@ pub enum Instruction {
left: Vec<P<Value>>,
right: Expression
},
Load{
dest: P<SSAVar>,
is_iref: bool,
mem_loc: P<Value>,
order: MemoryOrder
},
Store{
src: P<SSAVar>,
is_iref: bool,
mem_loc: P<Value>,
order: MemoryOrder
}
Fence(MemoryOrder),
}
pub enum Terminal {
......
use ast::ir::*;
use vm::context::VMContext;
use std::cell::RefCell;
pub mod passes;
......@@ -12,9 +14,9 @@ impl Compiler {
Compiler{policy: RefCell::new(policy)}
}
pub fn compile(&self, func: &mut MuFunction) {
pub fn compile(&self, vm: &VMContext, func: &mut MuFunction) {
for pass in self.policy.borrow_mut().passes.iter_mut() {
pass.execute(func);
pass.execute(vm, func);
}
}
}
......@@ -33,5 +35,5 @@ impl CompilerPolicy {
}
pub trait CompilerPass {
fn execute(&mut self, func: &mut MuFunction);
fn execute(&mut self, vm:&VMContext, func: &mut MuFunction);
}
use ast::ir::*;
use vm::context::VMContext;
use compiler::CompilerPass;
pub struct TreeGenerationPass;
......@@ -10,7 +12,7 @@ impl TreeGenerationPass {
}
impl CompilerPass for TreeGenerationPass {
fn execute(&mut self, func: &mut MuFunction) {
fn execute(&mut self, vm: &VMContext, func: &mut MuFunction) {
}
}
\ No newline at end of file
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