Skip to content

Commit

Permalink
Space-specific object semantics (#9)
Browse files Browse the repository at this point in the history
* Use SFT_MAP and is_live()
* Cleaned up interface, normalized names
* Update mmtk-core version
  • Loading branch information
steveblackburn authored May 28, 2020
1 parent 83de020 commit 2763eaf
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions mmtk/api/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down
23 changes: 9 additions & 14 deletions mmtk/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ pub extern "C" fn post_alloc(mutator: *mut SelectedMutator<JikesRVM>, 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]
Expand Down Expand Up @@ -118,11 +113,6 @@ pub extern "C" fn trace_get_forwarded_reference(trace_local: *mut SelectedTraceL
memory_manager::trace_get_forwarded_reference::<JikesRVM>(unsafe { &mut *trace_local }, object)
}

#[no_mangle]
pub extern "C" fn trace_is_live(trace_local: *mut SelectedTraceLocal<JikesRVM>, object: ObjectReference) -> bool{
memory_manager::trace_is_live::<JikesRVM>(unsafe { &mut *trace_local }, object)
}

#[no_mangle]
pub extern "C" fn trace_retain_referent(trace_local: *mut SelectedTraceLocal<JikesRVM>, object: ObjectReference) -> ObjectReference{
memory_manager::trace_retain_referent::<JikesRVM>(unsafe { &mut *trace_local }, object)
Expand All @@ -133,14 +123,19 @@ pub extern "C" fn handle_user_collection_request(tls: OpaquePointer) {
memory_manager::handle_user_collection_request::<JikesRVM>(&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]
Expand Down
6 changes: 3 additions & 3 deletions mmtk/src/reference_glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl ReferenceGlue<JikesRVM> 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)"); }
Expand All @@ -74,7 +74,7 @@ impl ReferenceGlue<JikesRVM> 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)) {
Expand All @@ -99,7 +99,7 @@ impl ReferenceGlue<JikesRVM> for VMReferenceGlue {
DebugUtil.dumpRef(oldReferent);
VM.sysFail("Invalid reference");
}*/
debug_assert!(trace.is_live(new_reference));
debug_assert!(new_reference.is_live());
}

/*
Expand Down

0 comments on commit 2763eaf

Please sign in to comment.