Skip to content

Commit caf4b9c

Browse files
authored
Update ObjectModel::copy() (#128)
1 parent 28ec1a7 commit caf4b9c

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

mmtk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ lazy_static = "1.1"
2020
# - change branch
2121
# - change repo name
2222
# But other changes including adding/removing whitespaces in commented lines may break the CI.
23-
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "5c4e9eae2c72651137ab0b51c9365256314901d2" }
23+
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "ad95d7797f020eaab1e608dc03b7db6a3d79839a" }
2424
# Uncomment the following to build locally
2525
# mmtk = { path = "../repos/mmtk-core" }
2626

mmtk/src/object_model.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ use std::sync::atomic::Ordering;
33
use super::UPCALLS;
44
use crate::{vm_metadata, OpenJDK};
55
use mmtk::util::alloc::fill_alignment_gap;
6+
use mmtk::util::copy::*;
67
use mmtk::util::metadata::header_metadata::HeaderMetadataSpec;
78
use mmtk::util::{Address, ObjectReference};
89
use mmtk::vm::*;
9-
use mmtk::AllocationSemantics;
10-
use mmtk::CopyContext;
1110

1211
pub struct VMObjectModel {}
1312

@@ -87,19 +86,18 @@ impl ObjectModel<OpenJDK> for VMObjectModel {
8786
#[inline]
8887
fn copy(
8988
from: ObjectReference,
90-
allocator: AllocationSemantics,
91-
copy_context: &mut impl CopyContext,
89+
copy: CopySemantics,
90+
copy_context: &mut GCWorkerCopyContext<OpenJDK>,
9291
) -> ObjectReference {
9392
let bytes = unsafe { ((*UPCALLS).get_object_size)(from) };
94-
let dst =
95-
copy_context.alloc_copy(from, bytes, ::std::mem::size_of::<usize>(), 0, allocator);
93+
let dst = copy_context.alloc_copy(from, bytes, ::std::mem::size_of::<usize>(), 0, copy);
9694
// Copy
9795
let src = from.to_address();
9896
for i in 0..bytes {
9997
unsafe { (dst + i).store((src + i).load::<u8>()) };
10098
}
10199
let to_obj = unsafe { dst.to_object_reference() };
102-
copy_context.post_copy(to_obj, unsafe { Address::zero() }, bytes, allocator);
100+
copy_context.post_copy(to_obj, bytes, copy);
103101
to_obj
104102
}
105103

0 commit comments

Comments
 (0)