Commit cf276acb authored by qinsoon's avatar qinsoon

add back gcbench, not working

parent 7b52143a
......@@ -11,6 +11,7 @@ use runtime::mm::heap::immix::ImmixMutatorLocal;
use runtime::mm::heap::freelist;
use runtime::mm::heap::freelist::FreeListSpace;
use std::fmt;
use std::sync::Arc;
use std::sync::RwLock;
use std::boxed::Box;
......@@ -21,10 +22,25 @@ pub struct GC {
lo_space : Arc<RwLock<FreeListSpace>>
}
impl fmt::Debug for GC {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "GC\n").unwrap();
write!(f, "{}", self.immix_space).unwrap();
let lo_lock = self.lo_space.read().unwrap();
write!(f, "{}", *lo_lock)
}
}
lazy_static! {
pub static ref MY_GC : RwLock<Option<GC>> = RwLock::new(None);
}
#[no_mangle]
pub extern fn gc_stats() {
println!("{:?}", MY_GC.read().unwrap().as_ref().unwrap());
}
#[no_mangle]
pub extern fn gc_init(immix_size: usize, lo_size: usize, n_gcthreads: usize) {
// set this line to turn on certain level of debugging info
......
extern crate mu;
#[macro_use]
extern crate log;
extern crate simple_logger;
......
......@@ -2,4 +2,4 @@ mod test_thread;
mod test_gc;
//disable this for now - it doesnt run
//mod test_gcbench;
\ No newline at end of file
mod test_gcbench;
\ No newline at end of file
......@@ -12,6 +12,8 @@ use mu::runtime::mm::heap::freelist;
use mu::runtime::mm::heap::freelist::FreeListSpace;
use std::mem::size_of;
use std::sync::atomic::Ordering;
use log;
use simple_logger;
extern crate time;
......@@ -112,9 +114,12 @@ fn alloc(mutator: &mut ImmixMutatorLocal) -> *mut Node {
#[test]
fn start() {
simple_logger::init_with_level(log::LogLevel::Trace).ok();
unsafe {heap::gc::set_low_water_mark();}
mm::gc_init(IMMIX_SPACE_SIZE, LO_SPACE_SIZE, 8);
mm::gc_stats();
let mut mutator = mm::new_mutator();
println!("Garbage Collector Test");
......@@ -136,7 +141,7 @@ fn start() {
Populate(kLongLivedTreeDepth, longLivedTree, &mut mutator);
println!(" Creating a long-lived array of {} doubles", kArraySize);
mem::alloc_large(&mut mutator, size_of::<Array>(), 8);
mm::alloc_large(&mut mutator, size_of::<Array>(), 8);
PrintDiagnostics();
......
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