GitLab will continue to be upgraded from 11.4.5-ce.0 on November 25th 2019 at 4.00pm (AEDT) to 5.00pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available.

Commit c29c8471 authored by qinsoon's avatar qinsoon

[wip] fixed rwlock problem. failing doctest

parent 27886d4d
......@@ -1160,9 +1160,13 @@ pub fn emit_context(vm: &VM) {
}
// serialize vm
{
let serialize_vm = json::encode(&vm).unwrap();
file.write("\t.data\n".as_bytes()).unwrap();
file.write_fmt(format_args!("vm: .asciiz \"{}\"", json::encode(&vm).unwrap())).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,6 +25,7 @@ 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();
......@@ -32,5 +33,6 @@ fn test_global_access() {
let mut func_ver = func_vers.get(&func.cur_ver.unwrap()).unwrap().write().unwrap();
compiler.compile(&mut func_ver);
}
backend::emit_context(&vm);
}
......@@ -22,12 +22,14 @@ 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);
}
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