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.6% of users enabled 2FA.

Commit c29c8471 authored by qinsoon's avatar qinsoon
Browse files

[wip] fixed rwlock problem. failing doctest

parent 27886d4d
......@@ -1160,9 +1160,13 @@ pub fn emit_context(vm: &VM) {
}
// serialize vm
file.write("\t.data\n".as_bytes()).unwrap();
file.write_fmt(format_args!("vm: .asciiz \"{}\"", json::encode(&vm).unwrap())).unwrap();
file.write("\n".as_bytes()).unwrap();
{
let serialize_vm = json::encode(&vm).unwrap();
file.write("\t.data\n".as_bytes()).unwrap();
file.write_fmt(format_args!("vm: .asciiz \"{}\"", serialize_vm)).unwrap();
file.write("\n".as_bytes()).unwrap();
}
// main_thread
// let primordial = vm.primordial.read().unwrap();
......
pub extern crate immix_rust as gc;
pub use gc::common::Address;
pub use gc::common::ObjectReference;
......
......@@ -5,7 +5,7 @@ use ast::ptr::*;
use ast::types::*;
use vm::VM;
use runtime::ValueLocation;
use runtime::gc;
use gc;
use utils::ByteSize;
use utils::Address;
......
......@@ -8,10 +8,10 @@ use compiler::backend;
use compiler::backend::BackendTypeInfo;
use vm::machine_code::CompiledFunction;
use vm::vm_options::VMOptions;
use runtime::gc;
use runtime::thread::*;
use runtime::ValueLocation;
use utils::Address;
use gc;
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
......@@ -60,7 +60,7 @@ impl Encodable for VM {
fn encode<S: Encoder> (&self, s: &mut S) -> Result<(), S::Error> {
// serialize VM_SERIALIZE_FIELDS fields
// PLUS ONE extra global STRUCT_TAG_MAP
s.emit_struct("VM", VM_SERIALIZE_FIELDS, |s| {
s.emit_struct("VM", VM_SERIALIZE_FIELDS + 1, |s| {
// next_id
try!(s.emit_struct_field("next_id", 0, |s| {
s.emit_usize(self.next_id.load(Ordering::SeqCst))
......
extern crate mu;
extern crate log;
extern crate simple_logger;
extern crate immix_rust as gc;
mod test_ir;
mod test_compiler;
......
......@@ -25,12 +25,14 @@ fn test_global_access() {
Box::new(backend::code_emission::CodeEmission::new())
]), vm.clone());
let func_id = vm.id_of("global_access");
let funcs = vm.funcs().read().unwrap();
let func = funcs.get(&func_id).unwrap().read().unwrap();
let func_vers = vm.func_vers().read().unwrap();
let mut func_ver = func_vers.get(&func.cur_ver.unwrap()).unwrap().write().unwrap();
compiler.compile(&mut func_ver);
{
let func_id = vm.id_of("global_access");
let funcs = vm.funcs().read().unwrap();
let func = funcs.get(&func_id).unwrap().read().unwrap();
let func_vers = vm.func_vers().read().unwrap();
let mut func_ver = func_vers.get(&func.cur_ver.unwrap()).unwrap().write().unwrap();
compiler.compile(&mut func_ver);
}
backend::emit_context(&vm);
}
......@@ -21,13 +21,15 @@ fn test_thread_create() {
let compiler = Compiler::new(CompilerPolicy::default(), vm.clone());
let func_id = vm.id_of("fac");
let funcs = vm.funcs().read().unwrap();
let func = funcs.get(&func_id).unwrap().read().unwrap();
let func_vers = vm.func_vers().read().unwrap();
let mut func_ver = func_vers.get(&func.cur_ver.unwrap()).unwrap().write().unwrap();
compiler.compile(&mut func_ver);
let func_id = vm.id_of("fac");
{
let funcs = vm.funcs().read().unwrap();
let func = funcs.get(&func_id).unwrap().read().unwrap();
let func_vers = vm.func_vers().read().unwrap();
let mut func_ver = func_vers.get(&func.cur_ver.unwrap()).unwrap().write().unwrap();
compiler.compile(&mut func_ver);
}
vm.make_primordial_thread(func_id, vec![Constant::Int(5)]);
backend::emit_context(&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