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

benchmark runs, needs debugging memory allocation

parent 031c6307
...@@ -91,6 +91,13 @@ impl Instruction { ...@@ -91,6 +91,13 @@ impl Instruction {
| DeleteFutex(_) | DeleteFutex(_)
| LockFutex(_,_) | LockFutex(_,_)
| UnlockFutex(_,_) | UnlockFutex(_,_)
| CondVarNew
| CondVarDelete(_)
| CondVarAcqLock(_)
| CondVarRelLock(_)
| CondVarWait(_)
| CondVarSignal(_)
| CondVarBroadcast(_)
| AllocAU(_) | AllocAU(_)
| AllocAUHybrid(_,_) | AllocAUHybrid(_,_)
| NewReg(_) | NewReg(_)
...@@ -206,6 +213,13 @@ impl Instruction { ...@@ -206,6 +213,13 @@ impl Instruction {
| DeleteFutex(_) | DeleteFutex(_)
| LockFutex(_,_) | LockFutex(_,_)
| UnlockFutex(_,_) | UnlockFutex(_,_)
| CondVarNew
| CondVarDelete(_)
| CondVarAcqLock(_)
| CondVarRelLock(_)
| CondVarWait(_)
| CondVarSignal(_)
| CondVarBroadcast(_)
| NotifyThread(_) | NotifyThread(_)
| ThreadSetPriority(_, _) | ThreadSetPriority(_, _)
| ThreadClearCPU(_, _) | ThreadClearCPU(_, _)
...@@ -334,6 +348,13 @@ impl Instruction { ...@@ -334,6 +348,13 @@ impl Instruction {
| DeleteFutex(_) | DeleteFutex(_)
| LockFutex(_, _) | LockFutex(_, _)
| UnlockFutex(_,_) | UnlockFutex(_,_)
| CondVarNew
| CondVarDelete(_)
| CondVarAcqLock(_)
| CondVarRelLock(_)
| CondVarWait(_)
| CondVarSignal(_)
| CondVarBroadcast(_)
| NotifyThread(_) | NotifyThread(_)
| ThreadSetPriority(_, _) | ThreadSetPriority(_, _)
| ThreadGetPriority(_) | ThreadGetPriority(_)
...@@ -458,6 +479,13 @@ impl Instruction { ...@@ -458,6 +479,13 @@ impl Instruction {
| DeleteFutex(_) | DeleteFutex(_)
| LockFutex(_,_) | LockFutex(_,_)
| UnlockFutex(_,_) | UnlockFutex(_,_)
| CondVarNew
| CondVarDelete(_)
| CondVarAcqLock(_)
| CondVarRelLock(_)
| CondVarWait(_)
| CondVarSignal(_)
| CondVarBroadcast(_)
| NotifyThread(_) | NotifyThread(_)
| ThreadSetPriority(_,_) // FIXME - Not sure about these | ThreadSetPriority(_,_) // FIXME - Not sure about these
| ThreadGetPriority(_) | ThreadGetPriority(_)
...@@ -574,6 +602,13 @@ impl Instruction { ...@@ -574,6 +602,13 @@ impl Instruction {
| DeleteFutex(_) | DeleteFutex(_)
| LockFutex(_,_) | LockFutex(_,_)
| UnlockFutex(_,_) | UnlockFutex(_,_)
| CondVarNew
| CondVarDelete(_)
| CondVarAcqLock(_)
| CondVarRelLock(_)
| CondVarWait(_)
| CondVarSignal(_)
| CondVarBroadcast(_)
| NotifyThread(_) | | NotifyThread(_) |
ThreadSetPriority(_,_) | ThreadSetPriority(_,_) |
NewFrameCursor(_) | NewFrameCursor(_) |
...@@ -816,6 +851,28 @@ impl Instruction { ...@@ -816,6 +851,28 @@ impl Instruction {
format!("UNLOCKFUTEX {}, {}", ops[futexref], ops[count]) format!("UNLOCKFUTEX {}, {}", ops[futexref], ops[count])
} }
&Instruction_::CondVarNew => {
format!("CONDVAR_NEW")
}
&Instruction_::CondVarDelete(addr) => {
format!("CONDVAR_DELETE {}", ops[addr])
}
&Instruction_::CondVarAcqLock(addr) => {
format!("CONDVAR_ACQ_LOCK {}", ops[addr])
}
&Instruction_::CondVarRelLock(addr) => {
format!("CONDVAR_REL_LOCK {}", ops[addr])
}
&Instruction_::CondVarWait(addr) => {
format!("CONDVAR_WAIT {}", ops[addr])
}
&Instruction_::CondVarSignal(addr) => {
format!("CONDVAR_SIGNAL {}", ops[addr])
}
&Instruction_::CondVarBroadcast(addr) => {
format!("CONDVAR_BROADCAST {}", ops[addr])
}
&Instruction_::NewRTThread { &Instruction_::NewRTThread {
attr, attr,
stack, stack,
...@@ -1447,6 +1504,14 @@ pub enum Instruction_ { ...@@ -1447,6 +1504,14 @@ pub enum Instruction_ {
LockFutex(OpIndex, OpIndex), LockFutex(OpIndex, OpIndex),
UnlockFutex(OpIndex, OpIndex), UnlockFutex(OpIndex, OpIndex),
CondVarNew,
CondVarDelete(OpIndex),
CondVarAcqLock(OpIndex),
CondVarRelLock(OpIndex),
CondVarWait(OpIndex),
CondVarSignal(OpIndex),
CondVarBroadcast(OpIndex),
// #[cfg(feature = "realtime")] // #[cfg(feature = "realtime")]
/// notify a thread to start running /// notify a thread to start running
/// args: threadref for the target thread /// args: threadref for the target thread
......
...@@ -24,6 +24,7 @@ use std::fmt; ...@@ -24,6 +24,7 @@ use std::fmt;
use std::ptr; use std::ptr;
use std::sync::atomic::{AtomicPtr, Ordering}; use std::sync::atomic::{AtomicPtr, Ordering};
use std::sync::RwLock; use std::sync::RwLock;
use std::intrinsics::write_bytes;
// some common types that the compiler may use internally // some common types that the compiler may use internally
//#[cfg(not(feature = "realtime"))] //#[cfg(not(feature = "realtime"))]
...@@ -72,6 +73,8 @@ lazy_static! { ...@@ -72,6 +73,8 @@ lazy_static! {
P(MuType::new(new_internal_id(), MuType_::threadref())); P(MuType::new(new_internal_id(), MuType_::threadref()));
pub static ref FUTEXREF_TYPE: P<MuType> = pub static ref FUTEXREF_TYPE: P<MuType> =
P(MuType::new(new_internal_id(), MuType_::futexref())); P(MuType::new(new_internal_id(), MuType_::futexref()));
pub static ref CONDVARREF_TYPE: P<MuType> =
P(MuType::new(new_internal_id(), MuType_::condvarref()));
} }
#[cfg(not(feature = "realtime"))] #[cfg(not(feature = "realtime"))]
...@@ -93,6 +96,7 @@ lazy_static! { ...@@ -93,6 +96,7 @@ lazy_static! {
STACKREF_TYPE.clone(), STACKREF_TYPE.clone(),
THREADREF_TYPE.clone(), THREADREF_TYPE.clone(),
FUTEXREF_TYPE.clone(), FUTEXREF_TYPE.clone(),
CONDVARREF_TYPE.clone(),
UPTR_U8_TYPE.clone(), UPTR_U8_TYPE.clone(),
UPTR_U64_TYPE.clone() UPTR_U64_TYPE.clone()
]; ];
...@@ -124,6 +128,7 @@ lazy_static! { ...@@ -124,6 +128,7 @@ lazy_static! {
IREF_VOID_TYPE.clone(), IREF_VOID_TYPE.clone(),
STACKREF_TYPE.clone(), STACKREF_TYPE.clone(),
THREADREF_TYPE.clone(), THREADREF_TYPE.clone(),
CONDVARREF_TYPE.clone(),
UPTR_U8_TYPE.clone(), UPTR_U8_TYPE.clone(),
UPTR_U64_TYPE.clone(), UPTR_U64_TYPE.clone(),
ATTRREF_TYPE.clone(), ATTRREF_TYPE.clone(),
...@@ -284,7 +289,8 @@ impl MuType { ...@@ -284,7 +289,8 @@ impl MuType {
MuType_::FuncRef(_) MuType_::FuncRef(_)
| MuType_::StackRef | MuType_::StackRef
| MuType_::ThreadRef | MuType_::ThreadRef
| MuType_::FutexRef => true, | MuType_::FutexRef
| MuType_::CondVarRef => true,
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
MuType_::RegionRef => true, MuType_::RegionRef => true,
...@@ -336,6 +342,7 @@ impl MuType { ...@@ -336,6 +342,7 @@ impl MuType {
| MuType_::StackRef | MuType_::StackRef
| MuType_::Tagref64 | MuType_::Tagref64
| MuType_::FutexRef | MuType_::FutexRef
| MuType_::CondVarRef
| MuType_::UPtr(_) => true, | MuType_::UPtr(_) => true,
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
MuType_::AttrRef MuType_::AttrRef
...@@ -567,7 +574,7 @@ impl MuType { ...@@ -567,7 +574,7 @@ impl MuType {
match self.v { match self.v {
Int(len) => Some(len), Int(len) => Some(len),
Ref(_) | IRef(_) | WeakRef(_) | UPtr(_) | ThreadRef | StackRef Ref(_) | IRef(_) | WeakRef(_) | UPtr(_) | ThreadRef | StackRef
| FutexRef | Tagref64 | FuncRef(_) | UFuncPtr(_) => Some(64), | FutexRef | CondVarRef | Tagref64 | FuncRef(_) | UFuncPtr(_) => Some(64),
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
RegionRef => Some(64), RegionRef => Some(64),
...@@ -698,6 +705,7 @@ pub enum MuType_ { ...@@ -698,6 +705,7 @@ pub enum MuType_ {
/// ufuncptr<@sig> /// ufuncptr<@sig>
UFuncPtr(P<MuFuncSig>), UFuncPtr(P<MuFuncSig>),
FutexRef, FutexRef,
CondVarRef,
/// RTMu-specific /// RTMu-specific
/// Real-Time Threads' attributes /// Real-Time Threads' attributes
...@@ -722,12 +730,12 @@ impl MuType_ { ...@@ -722,12 +730,12 @@ impl MuType_ {
#[cfg(not(feature = "realtime"))] #[cfg(not(feature = "realtime"))]
rodal_enum!(MuType_{(Int: size), Float, Double, (Ref: ty), (IRef: ty), (WeakRef: ty), (UPtr: ty), rodal_enum!(MuType_{(Int: size), Float, Double, (Ref: ty), (IRef: ty), (WeakRef: ty), (UPtr: ty),
(Struct: tag), (Array: ty, size), (Hybrid: tag), Void, ThreadRef, StackRef, FutexRef, Tagref64, (Struct: tag), (Array: ty, size), (Hybrid: tag), Void, ThreadRef, StackRef, FutexRef, CondVarRef, Tagref64,
(Vector: ty, size), (FuncRef: ty), (UFuncPtr: ty)}); (Vector: ty, size), (FuncRef: ty), (UFuncPtr: ty)});
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
rodal_enum!(MuType_{(Int: size), Float, Double, (Ref: ty), (IRef: ty), (WeakRef: ty), (UPtr: ty), rodal_enum!(MuType_{(Int: size), Float, Double, (Ref: ty), (IRef: ty), (WeakRef: ty), (UPtr: ty),
(Struct: tag), (Array: ty, size), (Hybrid: tag), Void, ThreadRef, RegionRef, TimerRef, FutexRef, TimeVal, AttrRef, StackRef, Tagref64, (Struct: tag), (Array: ty, size), (Hybrid: tag), Void, ThreadRef, RegionRef, TimerRef, FutexRef, CondVarRef, TimeVal, AttrRef, StackRef, Tagref64,
(Vector: ty, size), (FuncRef: ty), (UFuncPtr: ty)}); (Vector: ty, size), (FuncRef: ty), (UFuncPtr: ty)});
impl fmt::Display for MuType { impl fmt::Display for MuType {
...@@ -752,6 +760,7 @@ impl fmt::Display for MuType_ { ...@@ -752,6 +760,7 @@ impl fmt::Display for MuType_ {
&MuType_::Void => write!(f, "void"), &MuType_::Void => write!(f, "void"),
&MuType_::ThreadRef => write!(f, "threadref"), &MuType_::ThreadRef => write!(f, "threadref"),
&MuType_::FutexRef => write!(f, "futexref"), &MuType_::FutexRef => write!(f, "futexref"),
&MuType_::CondVarRef => write!(f, "condvarref"),
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
&MuType_::AttrRef => write!(f, "attrref"), &MuType_::AttrRef => write!(f, "attrref"),
...@@ -937,6 +946,9 @@ impl MuType_ { ...@@ -937,6 +946,9 @@ impl MuType_ {
pub fn futexref() -> MuType_ { pub fn futexref() -> MuType_ {
MuType_::FutexRef MuType_::FutexRef
} }
pub fn condvarref() -> MuType_ {
MuType_::CondVarRef
}
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
pub fn attrref() -> MuType_ { pub fn attrref() -> MuType_ {
......
...@@ -2787,6 +2787,27 @@ impl<'a> InstructionSelection { ...@@ -2787,6 +2787,27 @@ impl<'a> InstructionSelection {
} }
} }
} }
// FIXME. to finish it faster, I'm using rust atomic ops, may need fix
Instruction_::CmpXchg {
is_weak,
success_order,
fail_order,
mem_loc,
expected_value,
desired_value,
..
} => {
let res = self.get_result_value(node);
let resty = &res.ty.v;
match resty {
MuType_::Int(64) => {
;
}
_ => {
unimplemented!("Atomic compare and exchange for type: {}", resty);
}
}
}
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
Instruction_::NewRTThread { Instruction_::NewRTThread {
...@@ -2966,6 +2987,129 @@ impl<'a> InstructionSelection { ...@@ -2966,6 +2987,129 @@ impl<'a> InstructionSelection {
); );
} }
Instruction_::CondVarNew => {
trace!("instsel on CondVarNew");
let res = self.get_result_value(node);
self.emit_runtime_entry(
&entrypoints::CONDVAR_NEW,
vec![],
Some(vec![res]),
Some(node),
f_content,
f_context,
vm
);
}
Instruction_::CondVarDelete(condref) => {
trace!("instsel on CondVarDelete");
let ref ops = inst.ops;
let ref condref = ops[condref];
let tmp_condref =
self.emit_ireg(condref, f_content, f_context, vm);
self.emit_runtime_entry(
&entrypoints::CONDVAR_DELETE,
vec![tmp_condref],
None,
Some(node),
f_content,
f_context,
vm
);
}
Instruction_::CondVarAcqLock(condref) => {
trace!("instsel on CondVarAcqLock");
let ref ops = inst.ops;
let ref condref = ops[condref];
let tmp_condref =
self.emit_ireg(condref, f_content, f_context, vm);
self.emit_runtime_entry(
&entrypoints::CONDVAR_ACQ_LOCK,
vec![tmp_condref],
None,
Some(node),
f_content,
f_context,
vm
);
}
Instruction_::CondVarRelLock(condref) => {
trace!("instsel on CondVarRelLock");
let ref ops = inst.ops;
let ref condref = ops[condref];
let tmp_condref =
self.emit_ireg(condref, f_content, f_context, vm);
self.emit_runtime_entry(
&entrypoints::CONDVAR_REL_LOCK,
vec![tmp_condref],
None,
Some(node),
f_content,
f_context,
vm
);
}
Instruction_::CondVarWait(condref) => {
trace!("instsel on CondVarWait");
let ref ops = inst.ops;
let ref condref = ops[condref];
let tmp_condref =
self.emit_ireg(condref, f_content, f_context, vm);
self.emit_runtime_entry(
&entrypoints::CONDVAR_WAIT,
vec![tmp_condref],
None,
Some(node),
f_content,
f_context,
vm
);
}
Instruction_::CondVarSignal(condref) => {
trace!("instsel on CondVarSignal");
let ref ops = inst.ops;
let ref condref = ops[condref];
let tmp_condref =
self.emit_ireg(condref, f_content, f_context, vm);
self.emit_runtime_entry(
&entrypoints::CONDVAR_SIGNAL,
vec![tmp_condref],
None,
Some(node),
f_content,
f_context,
vm
);
}
Instruction_::CondVarBroadcast(condref) => {
trace!("instsel on CondVarBroadcast");
let ref ops = inst.ops;
let ref condref = ops[condref];
let tmp_condref =
self.emit_ireg(condref, f_content, f_context, vm);
self.emit_runtime_entry(
&entrypoints::CONDVAR_BROADCAST,
vec![tmp_condref],
None,
Some(node),
f_content,
f_context,
vm
);
}
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
Instruction_::ThreadGetPriority(thread) => { Instruction_::ThreadGetPriority(thread) => {
trace!("instsel on ThreadGetPriority"); trace!("instsel on ThreadGetPriority");
......
...@@ -717,6 +717,13 @@ pub fn estimate_insts_for_ir(inst: &Instruction) -> usize { ...@@ -717,6 +717,13 @@ pub fn estimate_insts_for_ir(inst: &Instruction) -> usize {
| NewThread { .. } | NewThread { .. }
| NewRTThread { .. } | NewRTThread { .. }
| NewFutex(_) | NewFutex(_)
| CondVarNew
| CondVarDelete(_)
| CondVarAcqLock(_)
| CondVarRelLock(_)
| CondVarWait(_)
| CondVarSignal(_)
| CondVarBroadcast(_)
| DeleteFutex(_) | DeleteFutex(_)
| LockFutex(_, _) | LockFutex(_, _)
| UnlockFutex(_,_) | UnlockFutex(_,_)
......
...@@ -270,7 +270,7 @@ impl BackendType { ...@@ -270,7 +270,7 @@ impl BackendType {
TypeEncode::short_noref(MINIMAL_ALIGNMENT, 1) TypeEncode::short_noref(MINIMAL_ALIGNMENT, 1)
} }
MuType_::FutexRef => TypeEncode::short_noref(MINIMAL_ALIGNMENT, 1), MuType_::CondVarRef | MuType_::FutexRef => TypeEncode::short_noref(MINIMAL_ALIGNMENT, 1),
// RTMu-specific // RTMu-specific
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
MuType_::RegionRef | MuType_::TimerRef => { MuType_::RegionRef | MuType_::TimerRef => {
...@@ -398,6 +398,7 @@ impl BackendType { ...@@ -398,6 +398,7 @@ impl BackendType {
| MuType_::FuncRef(_) | MuType_::FuncRef(_)
| MuType_::ThreadRef | MuType_::ThreadRef
| MuType_::FutexRef | MuType_::FutexRef
| MuType_::CondVarRef
| MuType_::StackRef => { | MuType_::StackRef => {
debug_assert!(pointer_aligned); debug_assert!(pointer_aligned);
res.push(WordType::NonRef); res.push(WordType::NonRef);
...@@ -536,6 +537,7 @@ impl BackendType { ...@@ -536,6 +537,7 @@ impl BackendType {
| MuType_::FuncRef(_) | MuType_::FuncRef(_)
| MuType_::ThreadRef | MuType_::ThreadRef
| MuType_::FutexRef | MuType_::FutexRef
| MuType_::CondVarRef
| MuType_::StackRef => BackendType { | MuType_::StackRef => BackendType {
ty: ty.clone(), ty: ty.clone(),
size: 8, size: 8,
...@@ -646,7 +648,7 @@ impl BackendType { ...@@ -646,7 +648,7 @@ impl BackendType {
// struct // struct
MuType_::Struct(ref name) => { MuType_::Struct(ref name) => {
trace!("BackendType::resolve::struct({})", name); trace!("BackendType::resolve::struct({})", name);
trace!("STRUCT_TAG_MAP: {:#?}", STRUCT_TAG_MAP); // trace!("STRUCT_TAG_MAP: {:#?}", STRUCT_TAG_MAP);
let read_lock = STRUCT_TAG_MAP.read().unwrap(); let read_lock = STRUCT_TAG_MAP.read().unwrap();
trace!("1"); trace!("1");
let struc = read_lock.get(name).unwrap(); let struc = read_lock.get(name).unwrap();
...@@ -984,6 +986,7 @@ impl RegGroup { ...@@ -984,6 +986,7 @@ impl RegGroup {
| MuType_::Tagref64 | MuType_::Tagref64
| MuType_::FuncRef(_) | MuType_::FuncRef(_)
| MuType_::FutexRef | MuType_::FutexRef
| MuType_::CondVarRef
| MuType_::UFuncPtr(_) => RegGroup::GPR, | MuType_::UFuncPtr(_) => RegGroup::GPR,
#[cfg(feature = "realtime")] #[cfg(feature = "realtime")]
......
...@@ -95,6 +95,13 @@ fn is_suitable_child(inst: &Instruction) -> bool { ...@@ -95,6 +95,13 @@ fn is_suitable_child(inst: &Instruction) -> bool {
| DeleteFutex(_) | DeleteFutex(_)
| LockFutex(_, _) | LockFutex(_, _)
| UnlockFutex(_,_) | UnlockFutex(_,_)
| CondVarNew
| CondVarDelete(_)
| CondVarAcqLock(_)
| CondVarRelLock(_)
| CondVarWait(_)
| CondVarSignal(_)
| CondVarBroadcast(_)
| NotifyThread(_) | NotifyThread(_)
| ThreadSetPriority(_, _) | ThreadSetPriority(_, _)
| ThreadGetPriority(_) | ThreadGetPriority(_)
......
...@@ -27,7 +27,7 @@ pub mod immix; ...@@ -27,7 +27,7 @@ pub mod immix;
pub const IMMIX_SPACE_RATIO: f64 = 1.0 - LO_SPACE_RATIO; pub const IMMIX_SPACE_RATIO: f64 = 1.0 - LO_SPACE_RATIO;
pub const LO_SPACE_RATIO: f64 = 0.2; pub const LO_SPACE_RATIO: f64 = 0.2;
pub const DEFAULT_HEAP_SIZE: usize = 500 << 20; pub const DEFAULT_HEAP_SIZE: usize = 15000 << 20;
// preallocating 16 GB for space // preallocating 16 GB for space
pub const LOG_BYTES_PREALLOC_SPACE: usize = 34; pub const LOG_BYTES_PREALLOC_SPACE: usize = 34;
......
...@@ -156,6 +156,7 @@ fn link_executable_internal( ...@@ -156,6 +156,7 @@ fn link_executable_internal(
let mut cc = Command::new(get_c_compiler()); let mut cc = Command::new(get_c_compiler());
cc.arg("-latomic");
// external libs // external libs
for path in libpath.iter() { for path in libpath.iter() {
cc.arg(format!("-L{}", path)); cc.arg(format!("-L{}", path));
......
...@@ -329,6 +329,41 @@ lazy_static! { ...@@ -329,6 +329,41 @@ lazy_static! {
vec![ADDRESS_TYPE.clone()], // (attrref) vec![ADDRESS_TYPE.clone()], // (attrref)
vec![] // returns nothing vec![] // returns nothing
);