Commit 2d919b3e authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano

Fixed botched merge (hopefully)

parent a184c8d8
Pipeline #978 failed with stages
in 3 minutes and 32 seconds
......@@ -948,7 +948,7 @@ impl fmt::Debug for BinOpStatus {
}
}
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum MemoryOrder {
NotAtomic,
Relaxed,
......@@ -1072,4 +1072,4 @@ fn op_vector_str(vec: &Vec<OpIndex>, ops: &Vec<P<TreeNode>>) -> String {
}
}
ret
}
\ No newline at end of file
}
......@@ -75,6 +75,14 @@ lazy_static! {
MuType::new(new_internal_id(), MuType_::iref(VOID_TYPE.clone()))
);
pub static ref STACKREF_TYPE : P<MuType> = P(
MuType::new(new_internal_id(), MuType_::StackRef)
);
pub static ref THREADREF_TYPE : P<MuType> = P(
MuType::new(new_internal_id(), MuType_::ThreadRef)
);
pub static ref INTERNAL_TYPES : Vec<P<MuType>> = vec![
ADDRESS_TYPE.clone(),
UINT1_TYPE.clone(),
......@@ -89,6 +97,8 @@ lazy_static! {
VOID_TYPE.clone(),
REF_VOID_TYPE.clone(),
IREF_VOID_TYPE.clone(),
STACKREF_TYPE.clone(),
THREADREF_TYPE.clone(),
];
}
......@@ -106,7 +116,7 @@ pub fn init_types() {
}
/// MuType represents a Mu type
#[derive(PartialEq, Debug)]
#[derive(Debug)]
pub struct MuType {
pub hdr: MuEntityHeader,
pub v: MuType_
......@@ -138,9 +148,17 @@ impl MuType {
_ => false
}
}
pub fn is_stackref(&self) -> bool {
match self.v {
MuType_::StackRef => true,
_ => false
}
}
pub fn is_funcref(&self) -> bool {
match self.v {
MuType_::FuncRef(_) => true,
MuType_::Struct(_) => true,
_ => false
}
}
......@@ -153,6 +171,13 @@ impl MuType {
}
}
pub fn is_void(&self) -> bool {
match self.v {
MuType_::Void => true,
_ => false
}
}
/// is this type hybrid type?
pub fn is_hybrid(&self) -> bool {
match self.v {
......@@ -432,7 +457,7 @@ pub type StructTag = MuName;
pub type HybridTag = MuName;
/// MuType_ is used for pattern matching for MuType
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Debug, Clone)]
pub enum MuType_ {
/// int <length>
Int(usize),
......@@ -480,7 +505,14 @@ pub enum MuType_ {
/// ufuncptr<@sig>
UFuncPtr(P<MuFuncSig>)
}
impl MuType_ {
pub fn strong_variant(&self) -> MuType_ {
match self {
&MuType_::WeakRef(ref t) => MuType_::Ref(t.clone()),
_ => self.clone()
}
}
}
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, Tagref64,
(Vector: ty, size), (FuncRef: ty), (UFuncPtr: ty)});
......@@ -788,4 +820,4 @@ impl fmt::Display for MuFuncSig {
}
}
pub type CFuncSig = MuFuncSig;
\ No newline at end of file
pub type CFuncSig = MuFuncSig;
......@@ -307,7 +307,6 @@ fn dfs(cur: MuID, stack: &mut Vec<MuID>, visited: &mut Vec<MuID>, func: &mut MuF
// call
Call { ref resume, .. } |
CCall { ref resume, .. } |
SwapStackExc { ref resume, .. } |
ExnInstruction { ref resume, .. } => {
let ref normal = resume.normal_dest;
let ref exn = resume.exn_dest;
......
......@@ -216,7 +216,6 @@ fn emit_muir_dot_inner(file: &mut File, f_name: String, f_content: &FunctionCont
}
Call { ref resume, .. } |
CCall { ref resume, .. } |
SwapStackExc { ref resume, .. } |
ExnInstruction { ref resume, .. } => {
let ref normal = resume.normal_dest;
let ref exn = resume.exn_dest;
......@@ -295,7 +294,7 @@ fn emit_muir_dot_inner(file: &mut File, f_name: String, f_content: &FunctionCont
vec_utils::as_str(&enable_dest.get_arguments(&ops))
).unwrap();
}
Return(_) | Throw(_) | ThreadExit | TailCall(_) | SwapStackKill { .. } => {}
Return(_) | Throw(_) | TailCall(_) => {}
_ => {
panic!("unexpected terminating instruction: {}", inst);
......
......@@ -234,8 +234,6 @@ impl CompilerPass for GenMovPhi {
}
Instruction_::Watchpoint { .. } => unimplemented!(),
Instruction_::WPBranch { .. } => unimplemented!(),
Instruction_::SwapStackExc { .. } |
Instruction_::SwapStackKill { .. } => unimplemented!(),
Instruction_::ExnInstruction { .. } => unimplemented!(),
_ => {
trace!("no rewrite");
......
......@@ -584,7 +584,6 @@ fn copy_inline_blocks(
&Instruction_::Watchpoint { .. } |
&Instruction_::WPBranch { .. } |
&Instruction_::SwapStackExc { .. } |
&Instruction_::ExnInstruction { .. } => unimplemented!(),
_ => {
......
This diff is collapsed.
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