Commit 3f5972b0 authored by qinsoon's avatar qinsoon

set a few fields in VM as private (same as others)

parent 99d0d117
......@@ -3609,7 +3609,7 @@ pub fn emit_context_with_reloc(
use runtime::mm;
// persist globals
let global_locs_lock = vm.global_locations.read().unwrap();
let global_locs_lock = vm.global_locations().read().unwrap();
let global_lock = vm.globals().read().unwrap();
let global_addr_id_map = {
......
......@@ -3874,7 +3874,7 @@ pub fn emit_context_with_reloc(
{
use runtime::mm;
let global_locs_lock = vm.global_locations.read().unwrap();
let global_locs_lock = vm.global_locations().read().unwrap();
let global_lock = vm.globals().read().unwrap();
// a map from address to ID
......
......@@ -63,7 +63,7 @@ pub extern "C" fn throw_exception_internal(exception_obj: Address, frame_cursor:
let sp;
{
// acquire lock for exception table
let compiled_callsite_table = vm.compiled_callsite_table.read().unwrap();
let compiled_callsite_table = vm.compiled_callsite_table().read().unwrap();
loop {
// Lookup the table for the callsite
......
......@@ -220,7 +220,7 @@ pub extern "C" fn mu_main(
};
let vm = VM::resume_vm(dumped_vm);
// find the primordial function as an entry
let primordial = vm.primordial.read().unwrap();
let primordial = vm.primordial().read().unwrap();
if primordial.is_none() {
panic!("no primordial thread/stack/function. Client should provide an entry point");
} else {
......
......@@ -86,7 +86,7 @@ pub struct VM {
/// functions declared to the VM
funcs: RwLock<HashMap<MuID, RwLock<MuFunction>>>, // +456
/// primordial function that is set to make boot image
pub primordial: RwLock<Option<PrimordialThreadInfo>>, // +568
primordial: RwLock<Option<PrimordialThreadInfo>>, // +568
/// current options for this VM
pub vm_options: VMOptions, // +624
......@@ -103,7 +103,7 @@ pub struct VM {
/// global cell locations. We use this map to create handles for global cells,
/// or dump globals into boot image. (this map does not get persisted because
/// the location is changed in different runs)
pub global_locations: RwLock<HashMap<MuID, ValueLocation>>,
global_locations: RwLock<HashMap<MuID, ValueLocation>>,
func_vers: RwLock<HashMap<MuID, RwLock<MuFunctionVersion>>>,
/// all the funcref that clients want to store for AOT which are pending stores
......@@ -114,10 +114,10 @@ pub struct VM {
/// runtime callsite table for exception handling
/// a map from callsite address to CompiledCallsite
pub compiled_callsite_table: RwLock<HashMap<Address, CompiledCallsite>>, // 896
compiled_callsite_table: RwLock<HashMap<Address, CompiledCallsite>>, // 896
/// Nnmber of callsites in the callsite tables
pub callsite_count: AtomicUsize
callsite_count: AtomicUsize
}
unsafe impl rodal::Dump for VM {
......@@ -909,6 +909,21 @@ impl<'a> VM {
&self.func_sigs
}
/// returns the lock for global locations
pub fn global_locations(&self) -> &RwLock<HashMap<MuID, ValueLocation>> {
&self.global_locations
}
/// returns the lock for primordial thread info
pub fn primordial(&self) -> &RwLock<Option<PrimordialThreadInfo>> {
&self.primordial
}
/// returns the lock for compiled callsite table
pub fn compiled_callsite_table(&self) -> &RwLock<HashMap<Address, CompiledCallsite>> {
&self.compiled_callsite_table
}
pub fn resolve_function_address(&self, func_id: MuID) -> ValueLocation {
let funcs = self.funcs.read().unwrap();
let func: &MuFunction = &funcs.get(&func_id).unwrap().read().unwrap();
......
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