To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit a72984a8 authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano
Browse files

Formating

parent b2102a36
......@@ -295,7 +295,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(_) | ThreadExit | TailCall(_) | SwapStackKill { .. } => {}
_ => {
panic!("unexpected terminating instruction: {}", inst);
......
......@@ -234,7 +234,8 @@ impl CompilerPass for GenMovPhi {
}
Instruction_::Watchpoint { .. } => unimplemented!(),
Instruction_::WPBranch { .. } => unimplemented!(),
Instruction_::SwapStackExc { .. } | Instruction_::SwapStackKill { .. } => unimplemented!(),
Instruction_::SwapStackExc { .. } |
Instruction_::SwapStackKill { .. } => unimplemented!(),
Instruction_::ExnInstruction { .. } => unimplemented!(),
_ => {
trace!("no rewrite");
......
......@@ -182,13 +182,8 @@ pub struct NodeKeepaliveClause {
#[derive(Debug)]
pub enum NodeCurrentStackClause {
RetWith {
id: MuID,
rettys: Vec<MuTypeNode>
},
KillOld {
id: MuID,
}
RetWith { id: MuID, rettys: Vec<MuTypeNode> },
KillOld { id: MuID }
}
#[derive(Debug)]
......@@ -198,10 +193,7 @@ pub enum NodeNewStackClause {
tys: Vec<MuTypeNode>,
vars: Vec<MuVarNode>
},
ThrowExc {
id: MuID,
exc: MuVarNode
}
ThrowExc { id: MuID, exc: MuVarNode }
}
#[derive(Debug)]
......
This diff is collapsed.
......@@ -75,18 +75,20 @@ pub struct VM {
name_id_map: RwLock<HashMap<MuName, MuID>>, // +64
/// types declared to the VM
types: RwLock<HashMap<MuID, P<MuType>>>, // +120
/// Ref types declared by 'make_strong_type', the key is the ID of the Referant
ref_types: RwLock<HashMap<MuID, P<MuType>>>,
/// types that are resolved as BackendType
backend_type_info: RwLock<HashMap<MuID, Box<BackendType>>>, // +176
backend_type_info: RwLock<HashMap<MuID, Box<BackendType>>>,
/// constants declared to the VM
constants: RwLock<HashMap<MuID, P<Value>>>, // +232
constants: RwLock<HashMap<MuID, P<Value>>>,
/// globals declared to the VM
globals: RwLock<HashMap<MuID, P<Value>>>, // +288
globals: RwLock<HashMap<MuID, P<Value>>>,
/// function signatures declared
func_sigs: RwLock<HashMap<MuID, P<MuFuncSig>>>, // +400
func_sigs: RwLock<HashMap<MuID, P<MuFuncSig>>>,
/// functions declared to the VM
funcs: RwLock<HashMap<MuID, RwLock<MuFunction>>>, // +456
funcs: RwLock<HashMap<MuID, RwLock<MuFunction>>>,
/// primordial function that is set to make boot image
primordial: RwLock<Option<PrimordialThreadInfo>>, // +568
primordial: RwLock<Option<PrimordialThreadInfo>>,
/// current options for this VM
pub vm_options: VMOptions, // +624
......@@ -129,6 +131,7 @@ unsafe impl rodal::Dump for VM {
dumper.dump_object(&self.id_name_map);
dumper.dump_object(&self.name_id_map);
dumper.dump_object(&self.types);
dumper.dump_object(&self.ref_types);
dumper.dump_object(&self.backend_type_info);
dumper.dump_object(&self.constants);
dumper.dump_object(&self.globals);
......@@ -213,6 +216,7 @@ impl<'a> VM {
name_id_map: RwLock::new(HashMap::new()),
constants: RwLock::new(HashMap::new()),
types: RwLock::new(HashMap::new()),
ref_types: RwLock::new(HashMap::new()),
backend_type_info: RwLock::new(HashMap::new()),
globals: RwLock::new(HashMap::new()),
global_locations: RwLock::new(hashmap!{}),
......@@ -789,6 +793,27 @@ impl<'a> VM {
}
}
pub fn make_strong_type(&self, ty: P<MuType>) -> P<MuType> {
match &ty.v {
&MuType_::WeakRef(ref t) => {
let res = self.ref_types
.read()
.unwrap()
.get(&t.id())
.map(|x| x.clone());
match res {
Some(ty) => ty,
None => {
let ty = P(MuType::new(self.next_id(), MuType_::muref(t.clone())));
self.ref_types.write().unwrap().insert(t.id(), ty.clone());
ty
}
}
}
_ => ty.clone()
}
}
/// adds a new bundle into VM.
/// This function will drain the contents of all arguments. Ideally, this function should
/// happen atomically. e.g. The client should not see a new type added without also seeing
......
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