Skip to content

Commit 8e893af

Browse files
authored
Update mmtk-core to PR #699 (#186)
1 parent 747b42e commit 8e893af

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

mmtk/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mmtk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ once_cell = "1.10.0"
2929
# - change branch
3030
# - change repo name
3131
# But other changes including adding/removing whitespaces in commented lines may break the CI.
32-
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "f82848847a6392537fec6b914d7ad95fbf28b0a2" }
32+
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "69b4fe46ee4353a2fdeb4911ba914b63a7ffa29a" }
3333
# Uncomment the following to build locally
3434
# mmtk = { path = "../repos/mmtk-core" }
3535

mmtk/src/api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub extern "C" fn handle_user_collection_request(tls: VMMutatorThread) {
211211

212212
#[no_mangle]
213213
pub extern "C" fn is_in_mmtk_spaces(object: ObjectReference) -> bool {
214-
memory_manager::is_in_mmtk_spaces(object)
214+
memory_manager::is_in_mmtk_spaces::<OpenJDK>(object)
215215
}
216216

217217
#[no_mangle]
@@ -386,7 +386,7 @@ pub extern "C" fn add_finalizer(object: ObjectReference) {
386386
pub extern "C" fn get_finalized_object() -> ObjectReference {
387387
match memory_manager::get_finalized_object(&SINGLETON) {
388388
Some(obj) => obj,
389-
None => unsafe { Address::ZERO.to_object_reference() },
389+
None => ObjectReference::NULL,
390390
}
391391
}
392392

mmtk/src/object_model.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ impl ObjectModel<OpenJDK> for VMObjectModel {
2727
let bytes = unsafe { Oop::from(from).size() };
2828
let dst = copy_context.alloc_copy(from, bytes, ::std::mem::size_of::<usize>(), 0, copy);
2929
// Copy
30-
let src = from.to_address();
30+
let src = from.to_raw_address();
3131
unsafe { std::ptr::copy_nonoverlapping::<u8>(src.to_ptr(), dst.to_mut_ptr(), bytes) }
32-
let to_obj = unsafe { dst.to_object_reference() };
32+
let to_obj = ObjectReference::from_raw_address(dst);
3333
copy_context.post_copy(to_obj, bytes, copy);
3434
to_obj
3535
}
@@ -39,22 +39,22 @@ impl ObjectModel<OpenJDK> for VMObjectModel {
3939
let bytes = unsafe { ((*UPCALLS).get_object_size)(from) };
4040
if need_copy {
4141
// copy obj to target
42-
let dst = to.to_address();
42+
let dst = to.to_raw_address();
4343
// Copy
44-
let src = from.to_address();
44+
let src = from.to_raw_address();
4545
for i in 0..bytes {
4646
unsafe { (dst + i).store((src + i).load::<u8>()) };
4747
}
4848
}
49-
let start = Self::object_start_ref(to);
49+
let start = Self::ref_to_object_start(to);
5050
if region != Address::ZERO {
5151
fill_alignment_gap::<OpenJDK>(region, start);
5252
}
5353
start + bytes
5454
}
5555

5656
fn get_reference_when_copied_to(_from: ObjectReference, to: Address) -> ObjectReference {
57-
unsafe { to.to_object_reference() }
57+
ObjectReference::from_raw_address(to)
5858
}
5959

6060
fn get_current_size(object: ObjectReference) -> usize {
@@ -78,12 +78,24 @@ impl ObjectModel<OpenJDK> for VMObjectModel {
7878
unimplemented!()
7979
}
8080

81-
fn object_start_ref(object: ObjectReference) -> Address {
82-
object.to_address()
81+
#[inline(always)]
82+
fn ref_to_object_start(object: ObjectReference) -> Address {
83+
object.to_raw_address()
8384
}
8485

86+
#[inline(always)]
8587
fn ref_to_address(object: ObjectReference) -> Address {
86-
object.to_address()
88+
object.to_raw_address()
89+
}
90+
91+
#[inline(always)]
92+
fn ref_to_header(object: ObjectReference) -> Address {
93+
object.to_raw_address()
94+
}
95+
96+
#[inline(always)]
97+
fn address_to_ref(address: Address) -> ObjectReference {
98+
ObjectReference::from_raw_address(address)
8799
}
88100

89101
fn dump_object(object: ObjectReference) {

0 commit comments

Comments
 (0)