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.

Commit 2c140a07 authored by qinsoon's avatar qinsoon
Browse files

restoring gc types in vm persisting

parent b0467947
......@@ -56,7 +56,7 @@ pub struct VM {
// partially serialize
// 13
compiled_funcs: RwLock<HashMap<MuID, RwLock<CompiledFunction>>>,
compiled_funcs: RwLock<HashMap<MuID, RwLock<CompiledFunction>>>,
}
const VM_SERIALIZE_FIELDS : usize = 14;
......@@ -474,6 +474,37 @@ impl <'a> VM {
let vm : VM = json::decode(serialized_vm).unwrap();
vm.init_vm();
// restore gc types
{
let type_info_guard = vm.backend_type_info.read().unwrap();
let mut type_info_vec: Vec<Box<BackendTypeInfo>> = type_info_guard.values().map(|x| x.clone()).collect();
type_info_vec.sort_by(|a, b| a.gc_type.id.cmp(&b.gc_type.id));
let mut expect_id = 0;
for ty_info in type_info_vec.iter() {
use runtime::mm;
let ref gc_type = ty_info.gc_type;
if gc_type.id != expect_id {
debug_assert!(expect_id < gc_type.id);
while expect_id < gc_type.id {
use runtime::mm::common::gctype::GCType;
mm::add_gc_type(GCType::new_noreftype(0));
expect_id += 1;
}
}
// now expect_id == gc_type.id
debug_assert!(expect_id == gc_type.id);
mm::add_gc_type(gc_type.as_ref().clone());
expect_id += 1;
}
}
vm
}
......
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