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 6572fe39 authored by Javad Ebrahimian Amiri's avatar Javad Ebrahimian Amiri
Browse files

implemented and tested instructions and intrinsics (except deadline, gc)

parent 184dec52
......@@ -184,5 +184,5 @@ mubench:
rustfmt:
stage: rustfmt
script:
- rustup run 1.35.0-x86_64-unknown-linux-gnu cargo-fmt -- --check --verbose -- src/lib.rs src/ast/src/lib.rs src/gc/src/lib.rs src/utils/src/lib.rs
- cargo-fmt +nightly -- --check --verbose -- src/lib.rs src/ast/src/lib.rs src/gc/src/lib.rs src/utils/src/lib.rs
allow_failure: true
......@@ -89,7 +89,7 @@ impl Instruction {
| NewRTThread { .. }
| NewFutex
| DeleteFutex(_)
| LockFutex(_)
| LockFutex(_,_)
| UnlockFutex(_)
| AllocAU(_)
| AllocAUHybrid(_,_)
......@@ -101,18 +101,35 @@ impl Instruction {
| eAllocHybrid(_, _)
| eDelete(_)
| NotifyThread(_) // TODO remove - not needed anymore
| SetPriority(_,_)
| GetPriority(_)
| AffinitySet(_,_)
| AffinityClear(_,_)
| AffinityIsset(_,_)
| ThreadSetPriority(_,_)
| ThreadGetPriority(_)
| ThreadSetCPU(_,_)
| ThreadClearCPU(_,_)
| ThreadIssetCPU(_,_)
| GetTime
| SetTime(_)
| NewTimer
| SetTimer(_,_,_,_)
| SetTimer(_,_,_,_,_)
| CancelTimer(_)
| DeleteTimer(_)
| Sleep(_)
| NewAttr
| DeleteAttr(_)
| ThreadSetAttr(_,_)
| ThreadGetAttr(_)
| AttrClearCPU(_,_)
| AttrIssetCPU(_,_)
| AttrSetCPU(_,_)
| AttrZeroCPU(_)
| AttrSetPriority(_,_)
| AttrGetPriority(_)
| eAllocPA(_,_)
| eAllocHybridPA(_,_,_)
| BindObject(_)
| UnbindObject(_)
| NewRegionPA(_,_)
| BindRegion(_)
| UnbindRegion(_)
| NewFrameCursor(_)
| GetIRef(_)
| GetFieldIRef { .. }
......@@ -187,19 +204,33 @@ impl Instruction {
| NewRTThread { .. }
| NewFutex
| DeleteFutex(_)
| LockFutex(_)
| LockFutex(_,_)
| UnlockFutex(_)
| NotifyThread(_)
| SetPriority(_, _)
| AffinityClear(_, _)
| AffinitySet(_, _)
| ThreadSetPriority(_, _)
| ThreadClearCPU(_, _)
| ThreadSetCPU(_, _)
// | AffinityZero(_)
| SetTime(_)
| NewTimer
| SetTimer(_,_,_,_)
| SetTimer(_,_,_,_,_)
| CancelTimer(_)
| DeleteTimer(_)
| Sleep(_)
| NewAttr
| DeleteAttr(_)
| ThreadSetAttr(_,_)
| AttrClearCPU(_,_)
| AttrSetCPU(_,_)
| AttrZeroCPU(_)
| AttrSetPriority(_,_)
| eAllocPA(_,_)
| eAllocHybridPA(_,_,_)
| BindObject(_)
| UnbindObject(_)
| NewRegionPA(_,_)
| BindRegion(_)
| UnbindRegion(_)
| NewFrameCursor(_)
| Fence(_)
| Return(_)
......@@ -250,11 +281,14 @@ impl Instruction {
| Move(_)
| CurrentStack
| GetVMThreadLocal
| GetPriority(_)
| ThreadGetPriority(_)
| GetTime
| ThreadGetAttr(_)
| AttrIssetCPU(_,_)
| AttrGetPriority(_)
| RandF(_,_)
| RandI(_,_)
| AffinityIsset(_, _) => false,
| ThreadIssetCPU(_, _) => false,
// | AffinityEqual(_, _)
}
}
......@@ -286,33 +320,50 @@ impl Instruction {
| AllocAHybrid(_, _)
| NewStack(_)
| AllocAU(_)
| AllocAUHybrid(_,_)
| AllocAUHybrid(_, _)
| NewReg(_)
| DeleteReg(_)
| rAlloc(_, _)
| rAllocHybrid(_,_, _)
| rAllocHybrid(_, _, _)
| eAlloc(_)
| eAllocHybrid(_,_)
| eAllocHybrid(_, _)
| eDelete(_)
| NewThread { .. }
| NewRTThread { .. }
| NewFutex
| DeleteFutex(_)
| LockFutex(_)
| LockFutex(_, _)
| UnlockFutex(_)
| NotifyThread(_)
| SetPriority(_, _)
| GetPriority(_)
| AffinityClear(_, _)
| AffinitySet(_, _)
| AffinityIsset(_, _)
| ThreadSetPriority(_, _)
| ThreadGetPriority(_)
| ThreadClearCPU(_, _)
| ThreadSetCPU(_, _)
| ThreadIssetCPU(_, _)
| GetTime
| SetTime(_)
| NewTimer
| SetTimer(_,_,_,_)
| SetTimer(_, _, _, _, _)
| CancelTimer(_)
| DeleteTimer(_)
| Sleep(_)
| NewAttr
| DeleteAttr(_)
| ThreadSetAttr(_, _)
| ThreadGetAttr(_)
| AttrClearCPU(_, _)
| AttrIssetCPU(_, _)
| AttrSetCPU(_, _)
| AttrZeroCPU(_)
| AttrSetPriority(_, _)
| AttrGetPriority(_)
| eAllocPA(_, _)
| eAllocHybridPA(_, _, _)
| BindObject(_)
| UnbindObject(_)
| NewRegionPA(_, _)
| BindRegion(_)
| UnbindRegion(_)
| NewFrameCursor(_)
| GetIRef(_)
| GetFieldIRef { .. }
......@@ -352,10 +403,10 @@ impl Instruction {
| GetVMThreadLocal
| KillStack(_)
| CurrentStack
| RandI(_,_)
| RandF(_,_)
| RandI(_, _)
| RandF(_, _)
| SwapStackExpr { .. }
| SwapStackKill { .. } => false,
| SwapStackKill { .. } => false
}
}
......@@ -405,23 +456,40 @@ impl Instruction {
| NewRTThread { .. }
| NewFutex
| DeleteFutex(_)
| LockFutex(_)
| LockFutex(_,_)
| UnlockFutex(_)
| NotifyThread(_)
| SetPriority(_,_) // FIXME - Not sure about these
| GetPriority(_)
| AffinityClear(_,_)
| ThreadSetPriority(_,_) // FIXME - Not sure about these
| ThreadGetPriority(_)
| ThreadClearCPU(_,_)
// | AffinityEqual(_,_)
| AffinityIsset(_,_)
| AffinitySet(_,_)
| ThreadIssetCPU(_,_)
| ThreadSetCPU(_,_)
// | AffinityZero(_)
| SetTime(_)
| GetTime
| NewTimer
| SetTimer(_,_,_,_)
| SetTimer(_,_,_,_,_)
| CancelTimer(_)
| DeleteTimer(_)
| Sleep(_)
| NewAttr
| DeleteAttr(_)
| ThreadSetAttr(_,_)
| ThreadGetAttr(_)
| AttrClearCPU(_,_)
| AttrIssetCPU(_,_)
| AttrSetCPU(_,_)
| AttrZeroCPU(_)
| AttrSetPriority(_,_)
| AttrGetPriority(_)
| eAllocPA(_,_)
| eAllocHybridPA(_,_,_)
| BindObject(_)
| UnbindObject(_)
| NewRegionPA(_,_)
| BindRegion(_)
| UnbindRegion(_)
| NewFrameCursor(_)
| GetIRef(_)
| GetFieldIRef { .. }
......@@ -504,10 +572,10 @@ impl Instruction {
NewRTThread { .. } |
NewFutex
| DeleteFutex(_)
| LockFutex(_)
| LockFutex(_,_)
| UnlockFutex(_)
| NotifyThread(_) |
SetPriority(_,_) |
ThreadSetPriority(_,_) |
NewFrameCursor(_) |
GetIRef(_) |
GetFieldIRef { .. } |
......@@ -682,9 +750,11 @@ impl Instruction {
&Instruction_::AllocAU(ref ty) => {
format!("COMMINST @uvm.AllocAU({})", ty.id())
}
&Instruction_::AllocAUHybrid(ref ty, var_len) => {
format!("COMMINST @uvm.AllocAUHybrid({}, {})", ty.id(), ops[var_len])
}
&Instruction_::AllocAUHybrid(ref ty, var_len) => format!(
"COMMINST @uvm.AllocAUHybrid({}, {})",
ty.id(),
ops[var_len]
),
&Instruction_::rAlloc(regref, ref ty) => {
format!("COMMINST @uvm.rAlloc({}, {})", ops[regref], ty.id())
}
......@@ -701,7 +771,7 @@ impl Instruction {
// ),
&Instruction_::eAlloc(ref ty) => {
format!("COMMINST @uvm.eAlloc({})", ty.id())
},
}
&Instruction_::eAllocHybrid(ref ty, var_len) => format!(
"COMMINST @uvm.eAllocHybrid({}, {})",
ty.id(),
......@@ -713,7 +783,7 @@ impl Instruction {
// ),
&Instruction_::eDelete(obj) => {
format!("COMMINST @uvm.eDelete({})", ops[obj])
},
}
// &Instruction_::eDeleteT( obj) => format!(
// "COMMINST @uvm.eDeleteT({})",
// ops[obj]
......@@ -733,27 +803,18 @@ impl Instruction {
"NEWTHREAD {}{} {}",
ops[stack], thread_local, new_stack_clause,
)
},
}
&Instruction_::NewFutex => format!("NEWFUTEX"),
&Instruction_::DeleteFutex(futexref) => {
format!(
"DELETEFUTEX {}",
ops[futexref]
)
},
&Instruction_::LockFutex(futexref) => {
format!(
"LockFUTEX {}",
ops[futexref]
)
},
format!("DELETEFUTEX {}", ops[futexref])
}
&Instruction_::LockFutex(futexref, timeout) => {
format!("LockFUTEX ({}, {})", ops[futexref], ops[timeout])
}
&Instruction_::UnlockFutex(futexref) => {
format!(
"UNLOCKFUTEX {}",
ops[futexref]
)
},
format!("UNLOCKFUTEX {}", ops[futexref])
}
&Instruction_::NewRTThread {
attr,
......@@ -771,59 +832,108 @@ impl Instruction {
"NEWRTTHREAD {}, {}, {}, {}",
ops[attr], ops[stack], thread_local, new_stack_clause,
)
},
}
&Instruction_::NotifyThread(thread) => {
format!("COMMINST @uvm.notifythread({})", ops[thread])
},
&Instruction_::SetPriority(thread, priority) => format!(
"COMMINST @uvm.setpriority({}, {})",
}
&Instruction_::ThreadSetPriority(thread, priority) => format!(
"COMMINST @uvm.threadsetpriority({}, {})",
ops[thread], ops[priority]
),
&Instruction_::GetPriority(thread) => {
format!("COMMINST @uvm.getpriority({})", ops[thread])
&Instruction_::ThreadGetPriority(thread) => {
format!("COMMINST @uvm.threadgetpriority({})", ops[thread])
}
&Instruction_::AffinityClear(thread, cpu) => format!(
"COMMINST @uvm.affinityclear({}, {})",
&Instruction_::ThreadClearCPU(thread, cpu) => format!(
"COMMINST @uvm.threadclearcpu({}, {})",
ops[thread], ops[cpu]
),
&Instruction_::AffinitySet(thread, cpu) => format!(
"COMMINST @uvm.affinityset({}, {})",
&Instruction_::ThreadSetCPU(thread, cpu) => format!(
"COMMINST @uvm.threadsetcpu({}, {})",
ops[thread], ops[cpu]
),
&Instruction_::AffinityIsset(thread, cpu) => format!(
"COMMINST @uvm.affinityisset({}, {})",
&Instruction_::ThreadIssetCPU(thread, cpu) => format!(
"COMMINST @uvm.threadissetcpu({}, {})",
ops[thread], ops[cpu]
),
&Instruction_::GetTime => format!(
"COMMINST @uvm.gettime()",
&Instruction_::GetTime => format!("COMMINST @uvm.gettime()",),
&Instruction_::SetTime(time) => {
format!("COMMINST @uvm.settime({})", ops[time])
}
&Instruction_::NewTimer => format!("COMMINST @uvm.newtimer"),
&Instruction_::SetTimer(tmr, tm, prd, func, args) => format!(
"COMMINST @uvm.settimer({}, {}, {}, {}, {})",
ops[tmr], ops[tm], ops[prd], ops[func], ops[args]
),
&Instruction_::SetTime(time) => format!(
"COMMINST @uvm.settime({})",
ops[time]
&Instruction_::CancelTimer(tmr) => {
format!("COMMINST @uvm.canceltimer({})", ops[tmr])
}
&Instruction_::DeleteTimer(tmr) => {
format!("COMMINST @uvm.deletetimer({})", ops[tmr])
}
&Instruction_::Sleep(dur) => {
format!("COMMINST @uvm.sleep_ns({})", ops[dur])
}
&Instruction_::NewAttr => format!("NEWATTR()"),
&Instruction_::DeleteAttr(aref) => {
format!("DELETEATTR({})", ops[aref])
}
&Instruction_::ThreadSetAttr(tref, aref) => {
format!("SETATTR({}, {})", ops[tref], ops[aref])
}
&Instruction_::ThreadGetAttr(tref) => {
format!("GETATTR({})", ops[tref])
}
&Instruction_::AttrSetPriority(aref, p) => format!(
"COMMINST @uvm.attr.setpriority({}, {})",
ops[aref], ops[p]
),
&Instruction_::NewTimer => format!(
"COMMINST @uvm.newtimer"
&Instruction_::AttrGetPriority(aref) => {
format!("COMMINST @uvm.attr.getpriority({})", ops[aref])
}
&Instruction_::AttrSetCPU(aref, c) => {
format!("COMMINST @uvm.attr.setcpu({}, {})", ops[aref], ops[c])
}
&Instruction_::AttrClearCPU(aref, c) => format!(
"COMMINST @uvm.attr.clearcpu({}, {})",
ops[aref], ops[c]
),
&Instruction_::SetTimer(tmr, tm, func, args) => format!(
"COMMINST @uvm.settimer({}, {}, {}, {})",
ops[tmr],
ops[tm],
ops[func],
ops[args]
&Instruction_::AttrIssetCPU(aref, c) => format!(
"COMMINST @uvm.attr.issetcpu({}, {})",
ops[aref], ops[c]
),
&Instruction_::CancelTimer(tmr) => format!(
"COMMINST @uvm.canceltimer({})",
ops[tmr]
&Instruction_::AttrZeroCPU(aref) => {
format!("COMMINST @uvm.attr.zerocpu({})", ops[aref])
}
&Instruction_::eAllocPA(ref ty, addr) => format!(
"COMMINST @uvm.emm.eallocpa({}, {})",
ty.id(),
ops[addr]
),
&Instruction_::DeleteTimer(tmr) => format!(
"COMMINST @uvm.deletetimer({})",
ops[tmr]
&Instruction_::eAllocHybridPA(ref ty, len, addr) => format!(
"COMMINST @uvm.emm.eallochybridpa({}, {}, {})",
ty.id(),
ops[len],
ops[addr]
),
&Instruction_::Sleep(dur) => format!(
"COMMINST @uvm.sleep_ns({})",
ops[dur]
&Instruction_::BindObject(obj) => {
format!("COMMINST @uvm.emm.bindobject({})", ops[obj])
}
&Instruction_::UnbindObject(obj) => {
format!("COMMINST @uvm.emm.unbindobject({})", ops[obj])
}
&Instruction_::NewRegionPA(size, addr) => format!(
"COMMINST @uvm.regions.newregionpa({}, {})",
ops[size], ops[addr]
),
&Instruction_::BindRegion(reg) => {
format!("COMMINST @uvm.regions.bindregion({})", ops[reg])
}
&Instruction_::UnbindRegion(reg) => {
format!("COMMINST @uvm.regions.unbindregion({})", ops[reg])
}
&Instruction_::NewFrameCursor(stack) => {
format!("COMMINST @uvm.meta.new_cursor({})", ops[stack])
}
......@@ -1120,11 +1230,14 @@ impl Instruction {
}
// set retval
&Instruction_::SetRetval(val) => format!("SETRETVAL {}", ops[val]),
&Instruction_::RandI(min, max) => format!("RandI ({}, {})", ops[min], ops[max]),
&Instruction_::RandF(min, max) => format!("RandF ({}, {})", ops[min], ops[max]),
&Instruction_::RandI(min, max) => {
format!("RandI ({}, {})", ops[min], ops[max])
}
&Instruction_::RandF(min, max) => {
format!("RandF ({}, {})", ops[min], ops[max])
}
// get vm thread local
&Instruction_::GetVMThreadLocal => format!("GETVMTHREADLOCAL")
}
}
}
......@@ -1242,11 +1355,15 @@ pub enum Instruction_ {
/// allocate an emm region
/// args: region size
NewReg(OpIndex),
NewRegionPA(OpIndex, OpIndex),
/// deallocate a whole emm region
/// args: regionref to the target region
DeleteReg(OpIndex),
BindRegion(OpIndex),
UnbindRegion(OpIndex),
/// allocates an untraced object on an emm region
/// args: 1. a regionref to the target emm region
/// args: 2. the object type
......@@ -1264,6 +1381,11 @@ pub enum Instruction_ {
/// returns: a uptr to the object
eAlloc(P<MuType>),
eAllocHybrid(P<MuType>, OpIndex),
eAllocPA(P<MuType>, OpIndex),
eAllocHybridPA(P<MuType>, OpIndex, OpIndex),
BindObject(OpIndex),
UnbindObject(OpIndex),
/// deallocate an untraced emm object
/// args: an uptr to the object
......@@ -1304,9 +1426,20 @@ pub enum Instruction_ {
args: Vec<OpIndex>
},
NewAttr,
DeleteAttr(OpIndex),
ThreadSetAttr(OpIndex, OpIndex),
ThreadGetAttr(OpIndex),
AttrSetPriority(OpIndex, OpIndex),
AttrGetPriority(OpIndex),
AttrSetCPU(OpIndex, OpIndex),
AttrClearCPU(OpIndex, OpIndex),
AttrIssetCPU(OpIndex, OpIndex),
AttrZeroCPU(OpIndex),
NewFutex,
DeleteFutex(OpIndex),
LockFutex(OpIndex),
LockFutex(OpIndex, OpIndex),
UnlockFutex(OpIndex),
// #[cfg(feature = "realtime")]
......@@ -1317,40 +1450,38 @@ pub enum Instruction_ {
/// args:
/// - threadref for the target thread
/// - the new priority value (int64)
SetPriority(OpIndex, OpIndex),
ThreadSetPriority(OpIndex, OpIndex),
/// get the current priority of a target thread
/// args:
/// - threadref for the target thread
/// returns:
/// - an int64 representing the current priority value
GetPriority(OpIndex),
// AffinityZero(OpIndex),
ThreadGetPriority(OpIndex),
// AffinityZero(OpIndex),
/// add a cpu to the cpu set of a thread
/// args:
/// - threadref of the target thread
/// - number of the cpu to add (e.g. #0 is the 1st cpu)
AffinitySet(OpIndex, OpIndex),
ThreadSetCPU(OpIndex, OpIndex),
/// remove a cpu from the cpu set of a thread
/// args:
/// - threadref of the target thread
/// - number of the cpu to remove (e.g. #0 is the 1st cpu)
AffinityClear(OpIndex, OpIndex),
ThreadClearCPU(OpIndex, OpIndex),
/// check whether a cpu is a member of the cpu set of a thread
/// args:
/// - threadref of the target thread
/// - number of the cpu to check (e.g. #0 is the 1st cpu)
AffinityIsset(OpIndex, OpIndex),
// AffinityEqual(OpIndex, OpIndex),
ThreadIssetCPU(OpIndex, OpIndex),
// AffinityEqual(OpIndex, OpIndex),
GetTime,
SetTime(OpIndex),
NewTimer,
SetTimer(OpIndex, OpIndex, OpIndex, OpIndex),
SetTimer(OpIndex, OpIndex, OpIndex, OpIndex, OpIndex),
CancelTimer(OpIndex),
DeleteTimer(OpIndex),
Sleep(OpIndex),
......
......@@ -133,7 +133,6 @@ impl fmt::Display for MuFunction {
}
}
// FIXME: currently part of compilation information is also stored in this data
// structure we should move them (see Issue #18)
rodal_named!(MuFunctionVersion);
......@@ -145,8 +144,9 @@ pub struct MuFunctionVersion {
pub func_id: MuID,
pub sig: P<MuFuncSig>,
orig_content: Option<FunctionContent>, // original IR
pub content: Option<FunctionContent>, /* IR that may have been rewritten
* during compilation */
pub content: Option<FunctionContent>, /* IR that may have been
* rewritten
* during compilation */
is_defined: bool,
is_compiled: bool,
pub context: FunctionContext,
......
......@@ -100,12 +100,8 @@ lazy_static! {
#[cfg(feature = "realtime")]
lazy_static! {
pub static ref RTATTR_TYPE: P<MuType> =
P(MuType::new(new_internal_id(), MuType_::rtattr()));
pub static ref UPTR_RTATTR_TYPE: P<MuType> = P(MuType::new(
new_internal_id(),
MuType_::uptr(RTATTR_TYPE.clone())
));
pub static ref ATTRREF_TYPE: P<MuType> =
P(MuType::new(new_internal_id(), MuType_::attrref()));
pub static ref REGREF_TYPE: P<MuType> =
P(MuType::new(new_internal_id(), MuType_::regionref()));
pub static ref TIMERREF_TYPE: P<MuType> =
......@@ -130,8 +126,7 @@ lazy_static! {
THREADREF_TYPE.clone(),
UPTR_U8_TYPE.clone(),
UPTR_U64_TYPE.clone(),
RTATTR_TYPE.clone(),