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 9f42305a authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano
Browse files

Reduced contents of name_id_map and id_name_map

parent d26902b9
......@@ -306,7 +306,7 @@ impl CompilerPass for GenMovPhi {
block_info.blk_id,
block_info.blk_name.clone()
));
vm.set_name(ret.as_entity());
//vm.set_name(ret.as_entity());
let mut target_block = f_content.get_block_mut(target_id);
assert!(target_block.content.is_some());
......
......@@ -255,7 +255,7 @@ impl Inlining {
body: vec![],
keepalives: None
});
vm.set_name(cur_block.as_entity());
//vm.set_name(cur_block.as_entity());
// deal with the inlined function
copy_inline_blocks(
......@@ -312,7 +312,7 @@ impl Inlining {
let mut intermediate_block = Block::new(
MuEntityHeader::named(vm.next_id(), int_block_name)
);
vm.set_name(intermediate_block.as_entity());
//vm.set_name(intermediate_block.as_entity());
// branch to normal_dest with normal_dest arguments
let normal_dest_args =
......
......@@ -56,7 +56,7 @@ impl CompilerPass for RetSink {
let mut block = Block::new(MuEntityHeader::named(vm.next_id(), block_name));
// tell the compiler this is the return sink
block.trace_hint = TraceHint::ReturnSink;
vm.set_name(block.as_entity());
//vm.set_name(block.as_entity());
let sig = func.sig.clone();
let args: Vec<P<Value>> = sig.ret_tys
......
......@@ -441,7 +441,7 @@ fn branch_adjustment(func: &mut MuFunctionVersion, vm: &VM) {
Arc::new(format!("{}:#{}:false", func.name(), node.id()));
let mut block =
Block::new(MuEntityHeader::named(vm.next_id(), block_name));
vm.set_name(block.as_entity());
//vm.set_name(block.as_entity());
let block_args: Vec<P<TreeNode>> = false_dest
.args
......
......@@ -182,7 +182,7 @@ fn print_backtrace(base: Address, compiled_callsite_table: &HashMap<Address, Com
"\tframe {:2}: 0x{:x} - {} (fid: #{}, fvid: #{}) at 0x{:x}",
frame_count,
compiled_func.start.to_address(),
vm.name_of(compiled_func.func_id),
vm.get_name_for_func(compiled_func.func_id),
compiled_func.func_id,
compiled_func.func_ver_id,
callsite
......
......@@ -35,8 +35,8 @@ pub struct MuIRBuilder {
/// Map IDs to names. Items are inserted during `gen_sym`. MuIRBuilder is supposed to be used
/// by one thread, so there is no need for locking.
id_name_map: HashMap<MuID, MuName>,
id_name_map: HashMap<MuID, MuName>, // Note: some of these entries may be generated internally
name_id_map: HashMap<MuName, MuID>, // Note: only contains names and ids of things the client gives names to
/// The "transient bundle" includes everything being built here.
bundle: TransientBundle
}
......@@ -68,6 +68,7 @@ impl MuIRBuilder {
mvm: mvm,
c_struct: ptr::null_mut(),
id_name_map: Default::default(),
name_id_map: Default::default(),
bundle: Default::default()
})
}
......@@ -132,13 +133,15 @@ impl MuIRBuilder {
match name {
None => {}
Some(the_name) => {
let old = self.id_name_map.insert(my_id, the_name);
let old_name = self.id_name_map.insert(my_id, the_name.clone());
let old_id = self.name_id_map.insert(the_name, my_id);
assert_ir!(old_id.is_none());
debug_assert!(
old.is_none(),
old_name.is_none(),
"ID already exists: {}, new name: {}, old name: {}",
my_id,
self.id_name_map.get(&my_id).unwrap(),
old.unwrap()
old_name.unwrap()
);
}
};
......@@ -1249,6 +1252,7 @@ struct BundleLoader<'lb, 'lvm> {
b: &'lb MuIRBuilder,
vm: &'lvm VM,
id_name_map: HashMap<MuID, MuName>,
name_id_map: HashMap<MuName, MuID>,
visited: HashSet<MuID>,
built_types: IdPMap<MuType>,
built_sigs: IdPMap<MuFuncSig>,
......@@ -1283,12 +1287,14 @@ struct BundleLoader<'lb, 'lvm> {
fn load_bundle(b: &mut MuIRBuilder) {
let vm = b.get_vm();
let new_map = b.id_name_map.drain().collect::<HashMap<_, _>>();
let new_id_name_map = b.id_name_map.drain().collect::<HashMap<_, _>>();
let new_name_id_map = b.name_id_map.drain().collect::<HashMap<_, _>>();
let mut bl = BundleLoader {
b: b,
vm: vm,
id_name_map: new_map,
id_name_map: new_id_name_map,
name_id_map: new_name_id_map,
visited: Default::default(),
built_types: Default::default(),
built_sigs: Default::default(),
......@@ -4224,7 +4230,7 @@ impl<'lb, 'lvm> BundleLoader<'lb, 'lvm> {
trace!("Loading bundle to the VM...");
vm.declare_many(
&mut self.id_name_map,
&mut self.name_id_map,
&mut self.built_types,
&mut self.built_sigs,
&mut self.built_constants,
......
......@@ -841,7 +841,7 @@ impl<'a> VM {
/// a new function added.
pub fn declare_many(
&self,
new_id_name_map: &mut HashMap<MuID, MuName>,
new_name_id_map: &mut HashMap<MuName, MuID>,
new_types: &mut HashMap<MuID, P<MuType>>,
new_func_sigs: &mut HashMap<MuID, P<MuFuncSig>>,
new_constants: &mut HashMap<MuID, P<Value>>,
......@@ -862,7 +862,7 @@ impl<'a> VM {
let mut funcs = self.funcs.write().unwrap();
let mut func_vers = self.func_vers.write().unwrap();
for (id, name) in new_id_name_map.drain() {
for (name, id) in new_name_id_map.drain() {
id_name_map.insert(id, name.clone());
name_id_map.insert(name, id);
}
......@@ -1244,7 +1244,7 @@ impl<'a> VM {
let funcs = self.funcs.read().unwrap();
let func: &MuFunction = &funcs.get(&func_id).unwrap().read().unwrap();
let func_addr = resolve_symbol(self.name_of(func_id));
let func_addr = resolve_symbol(self.get_name_for_func(func_id));
let stack_arg_size = backend::call_stack_size(func.sig.clone(), self);
Box::new(MuStack::new(self.next_id(), func_addr, stack_arg_size))
......@@ -1572,7 +1572,7 @@ impl<'a> VM {
unsafe { addr.store::<u64>(PENDING_FUNCREF) };
// and record this funcref
let symbol = self.name_of(func_id);
let symbol = self.get_name_for_func(func_id);
let mut pending_funcref_guard = self.aot_pending_funcref_store.write().unwrap();
pending_funcref_guard.insert(
......
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