From 2763eaf2896084ca6fc7071ad5a46178a9bb449b Mon Sep 17 00:00:00 2001 From: Steve Blackburn Date: Thu, 28 May 2020 11:01:46 +1000 Subject: [PATCH] Space-specific object semantics (#9) * Use SFT_MAP and is_live() * Cleaned up interface, normalized names * Update mmtk-core version --- .gitmodules | 2 +- mmtk/api/mmtk.h | 5 ++--- mmtk/src/api.rs | 23 +++++++++-------------- mmtk/src/reference_glue.rs | 6 +++--- repos/jikesrvm | 2 +- repos/mmtk-core | 2 +- 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6f778232..c6ec508a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/mmtk/mmtk-core [submodule "repos/jikesrvm"] path = repos/jikesrvm - url = https://github.com/mmtk/jikesrvm + url = https://github.com/mmtk/jikesrvm \ No newline at end of file diff --git a/mmtk/api/mmtk.h b/mmtk/api/mmtk.h index a4a9f6f6..564947f7 100644 --- a/mmtk/api/mmtk.h +++ b/mmtk/api/mmtk.h @@ -30,8 +30,8 @@ extern void* alloc_slow_largeobject(MMTk_Mutator mutator, size_t size, extern void post_alloc(MMTk_Mutator mutator, void* refer, void* type_refer, int bytes, int allocator); -extern bool is_valid_ref(void* ref); -extern bool is_mapped_object(void* ref); +extern bool is_live_object(void* obj); +extern bool is_mapped_object(void* obj); extern bool is_mapped_address(void* addr); extern void modify_check(void* ref); @@ -53,7 +53,6 @@ extern void* trace_get_forwarded_reference(MMTk_TraceLocal trace_local, void* ob extern void* trace_retain_referent(MMTk_TraceLocal trace_local, void* obj); -extern bool trace_is_live(MMTk_TraceLocal trace_local, void* obj); extern void* trace_root_object(MMTk_TraceLocal trace_local, void* obj); extern void process_edge(MMTk_TraceLocal trace, void* obj); diff --git a/mmtk/src/api.rs b/mmtk/src/api.rs index a07aaee6..d9f88857 100644 --- a/mmtk/src/api.rs +++ b/mmtk/src/api.rs @@ -54,12 +54,7 @@ pub extern "C" fn post_alloc(mutator: *mut SelectedMutator, refer: Obj #[no_mangle] pub extern "C" fn will_never_move(object: ObjectReference) -> bool { - memory_manager::will_never_move(&SINGLETON, object) -} - -#[no_mangle] -pub extern "C" fn is_valid_ref(val: ObjectReference) -> bool { - memory_manager::is_valid_ref(&SINGLETON, val) + !object.is_movable() } #[no_mangle] @@ -118,11 +113,6 @@ pub extern "C" fn trace_get_forwarded_reference(trace_local: *mut SelectedTraceL memory_manager::trace_get_forwarded_reference::(unsafe { &mut *trace_local }, object) } -#[no_mangle] -pub extern "C" fn trace_is_live(trace_local: *mut SelectedTraceLocal, object: ObjectReference) -> bool{ - memory_manager::trace_is_live::(unsafe { &mut *trace_local }, object) -} - #[no_mangle] pub extern "C" fn trace_retain_referent(trace_local: *mut SelectedTraceLocal, object: ObjectReference) -> ObjectReference{ memory_manager::trace_retain_referent::(unsafe { &mut *trace_local }, object) @@ -133,14 +123,19 @@ pub extern "C" fn handle_user_collection_request(tls: OpaquePointer) { memory_manager::handle_user_collection_request::(&SINGLETON, tls); } +#[no_mangle] +pub extern "C" fn is_live_object(object: ObjectReference) -> bool{ + object.is_live() +} + #[no_mangle] pub extern "C" fn is_mapped_object(object: ObjectReference) -> bool { - memory_manager::is_mapped_object(&SINGLETON, object) + object.is_mapped() } #[no_mangle] -pub extern "C" fn is_mapped_address(object: Address) -> bool { - memory_manager::is_mapped_address(&SINGLETON, object) +pub extern "C" fn is_mapped_address(address: Address) -> bool { + address.is_mapped() } #[no_mangle] diff --git a/mmtk/src/reference_glue.rs b/mmtk/src/reference_glue.rs index 164d4a06..32d93e1a 100644 --- a/mmtk/src/reference_glue.rs +++ b/mmtk/src/reference_glue.rs @@ -48,7 +48,7 @@ impl ReferenceGlue for VMReferenceGlue { * If the reference is dead, we're done with it. Let it (and * possibly its referent) be garbage-collected. */ - if !trace.is_live(reference) { + if !reference.is_live() { VMReferenceGlue::clear_referent(reference); // Too much paranoia ... if TRACE_UNREACHABLE { trace!(" UNREACHABLE reference: {:?}", reference); } if TRACE_DETAIL { trace!(" (unreachable)"); } @@ -74,7 +74,7 @@ impl ReferenceGlue for VMReferenceGlue { if TRACE_DETAIL { trace!(" => {:?}", new_reference); } - if trace.is_live(old_referent) { + if old_referent.is_live() { if cfg!(feature = "debug") { // FIXME /*if (!DebugUtil.validRef(oldReferent)) { @@ -99,7 +99,7 @@ impl ReferenceGlue for VMReferenceGlue { DebugUtil.dumpRef(oldReferent); VM.sysFail("Invalid reference"); }*/ - debug_assert!(trace.is_live(new_reference)); + debug_assert!(new_reference.is_live()); } /* diff --git a/repos/jikesrvm b/repos/jikesrvm index cc2ee836..67dadebb 160000 --- a/repos/jikesrvm +++ b/repos/jikesrvm @@ -1 +1 @@ -Subproject commit cc2ee83616059afd7fb409648c1ec45f70f40a7b +Subproject commit 67dadebb060ed48687dabf7e30805ee70a810686 diff --git a/repos/mmtk-core b/repos/mmtk-core index 3387477c..b5bc801e 160000 --- a/repos/mmtk-core +++ b/repos/mmtk-core @@ -1 +1 @@ -Subproject commit 3387477cc10912606748bd1be610999fa1de28f6 +Subproject commit b5bc801e2f97ddf790ae54cba3458606daee9fdc