Skip to content

Commit

Permalink
Update to MMTK core PR #1159 (backport #160) (#161)
Browse files Browse the repository at this point in the history
<hr>This is an automatic backport of pull request #160 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Yi Lin <[email protected]>
  • Loading branch information
mergify[bot] and qinsoon authored Jul 24, 2024
1 parent 6a28736 commit 6e3eb37
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
8 changes: 4 additions & 4 deletions mmtk/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ lazy_static = "1.1"
# - change branch
# - change repo name
# But other changes including adding/removing whitespaces in commented lines may break the CI
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "56b2521d2b99848ee0613a0a5288fe6d81b754ba" }
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "a3a72f8e5795678eff06fdc1524f0b429a62ccc0" }
# Uncomment the following to build locally
# mmtk = { path = "../../mmtk-core" }
log = {version = "0.4", features = ["max_level_trace", "release_max_level_off"] }
Expand Down
12 changes: 6 additions & 6 deletions mmtk/src/julia_finalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ impl ArrayListT {
}
}

fn gc_ptr_clear_tag(addr: Address, tag: usize) -> ObjectReference {
fn gc_ptr_clear_tag(addr: Address, tag: usize) -> Address {
let addr = unsafe { Address::from_usize(addr & !tag) };
debug_assert!(!addr.is_zero());
unsafe { ObjectReference::from_raw_address_unchecked(addr) }
addr
}

pub fn gc_ptr_tag(addr: Address, tag: usize) -> bool {
Expand All @@ -138,7 +138,7 @@ fn sweep_finalizer_list(
let mut j = 0;
while i < list.len {
let v0: Address = list.get(i);
let v = gc_ptr_clear_tag(v0, 3);
let v = unsafe { ObjectReference::from_raw_address_unchecked(gc_ptr_clear_tag(v0, 3)) };
if v0.is_zero() {
i += 2;
// remove from this list
Expand Down Expand Up @@ -204,21 +204,21 @@ fn mark_finlist<T: ObjectTracer>(list: &mut ArrayListT, start: usize, tracer: &m
continue;
}

let new_obj = if gc_ptr_tag(cur, 1) {
let new_obj_addr = if gc_ptr_tag(cur, 1) {
// Skip next
i += 1;
debug_assert!(i < list.len);
cur_tag = 1;
gc_ptr_clear_tag(cur, 1)
} else {
// unsafe: We checked `cur.is_zero()` before.
unsafe { ObjectReference::from_raw_address_unchecked(cur) }
cur
};
if gc_ptr_tag(cur, 2) {
i += 1;
continue;
}

let new_obj = unsafe { ObjectReference::from_raw_address_unchecked(new_obj_addr) };
let traced = tracer.trace_object(new_obj);
// if object has moved, update the list applying the tag
list.set(cur_i, unsafe {
Expand Down
14 changes: 2 additions & 12 deletions mmtk/src/object_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,13 @@ impl ObjectModel<JuliaVM> for VMObjectModel {
res
}

#[inline(always)]
fn ref_to_address(object: ObjectReference) -> Address {
object.to_raw_address()
}

#[inline(always)]
fn address_to_ref(address: Address) -> ObjectReference {
// `address` is a result of `ref_to_address(object)`, where `object` cannot be NULL.
debug_assert!(!address.is_zero());
unsafe { ObjectReference::from_raw_address_unchecked(address) }
}

#[inline(always)]
fn ref_to_header(object: ObjectReference) -> Address {
object.to_raw_address()
}

const IN_OBJECT_ADDRESS_OFFSET: isize = 0;

fn dump_object(_object: ObjectReference) {
unimplemented!()
}
Expand Down

0 comments on commit 6e3eb37

Please sign in to comment.