Skip to content

Commit 9c114cf

Browse files
authored
Edge trait (#121)
Use the new API with Edge trait.
1 parent 1830999 commit 9c114cf

File tree

6 files changed

+245
-25
lines changed

6 files changed

+245
-25
lines changed

mmtk/Cargo.lock

Lines changed: 216 additions & 7 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
@@ -28,7 +28,7 @@ log = {version = "0.4", features = ["max_level_trace", "release_max_level_off"]
2828
# - change branch/rev
2929
# - change repo name
3030
# But other changes including adding/removing whitespaces in commented lines may break the CI.
31-
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "a96e8f991c91a81df51e7975849441f52fdbcdcc" }
31+
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "76131c493be38e421f5fb157f9900f850584554f" }
3232
# Uncomment the following to build locally - if you change the path locally, do not commit the change in a PR
3333
# mmtk = { path = "../repos/mmtk-core" }
3434

mmtk/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,21 @@ pub static mut JTOC_BASE: Address = Address::ZERO;
4343
#[derive(Default)]
4444
pub struct JikesRVM;
4545

46+
/// The type of edges in JikesRVM.
47+
///
48+
/// TODO: We start with Address to ease the transition.
49+
/// We should switch to the equivalent `mmtk::vm::edge_shape::SimpleEdge` later.
50+
pub type JikesRVMEdge = Address;
51+
4652
impl VMBinding for JikesRVM {
4753
type VMObjectModel = object_model::VMObjectModel;
4854
type VMScanning = scanning::VMScanning;
4955
type VMCollection = collection::VMCollection;
5056
type VMActivePlan = active_plan::VMActivePlan;
5157
type VMReferenceGlue = reference_glue::VMReferenceGlue;
5258

59+
type VMEdge = JikesRVMEdge;
60+
5361
const ALLOC_END_ALIGNMENT: usize = 4;
5462
}
5563

mmtk/src/scan_boot_image.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::scanning::EDGES_BUFFER_CAPACITY;
22
use crate::unboxed_size_constants::*;
33
use crate::JikesRVM;
4+
use crate::JikesRVMEdge;
45
use entrypoint::*;
56
use java_size_constants::*;
67
use mmtk::scheduler::*;
@@ -25,7 +26,7 @@ static REFS: AtomicUsize = AtomicUsize::new(0);
2526

2627
pub fn scan_boot_image(
2728
_tls: OpaquePointer,
28-
factory: &mut impl RootsWorkFactory,
29+
factory: &mut impl RootsWorkFactory<JikesRVMEdge>,
2930
subwork_id: usize,
3031
total_subwork: usize,
3132
) {
@@ -140,13 +141,13 @@ fn decode_long_encoding(cursor: Address) -> usize {
140141
}
141142
}
142143

143-
pub struct ScanBootImageRoots<F: RootsWorkFactory> {
144+
pub struct ScanBootImageRoots<F: RootsWorkFactory<JikesRVMEdge>> {
144145
factory: F,
145146
subwork_id: usize,
146147
total_subwork: usize,
147148
}
148149

149-
impl<F: RootsWorkFactory> ScanBootImageRoots<F> {
150+
impl<F: RootsWorkFactory<JikesRVMEdge>> ScanBootImageRoots<F> {
150151
pub fn new(factory: F, subwork_id: usize, total_subwork: usize) -> Self {
151152
Self {
152153
factory,
@@ -156,7 +157,7 @@ impl<F: RootsWorkFactory> ScanBootImageRoots<F> {
156157
}
157158
}
158159

159-
impl<F: RootsWorkFactory> GCWork<JikesRVM> for ScanBootImageRoots<F> {
160+
impl<F: RootsWorkFactory<JikesRVMEdge>> GCWork<JikesRVM> for ScanBootImageRoots<F> {
160161
fn do_work(&mut self, _worker: &mut GCWorker<JikesRVM>, _mmtk: &'static MMTK<JikesRVM>) {
161162
scan_boot_image(
162163
OpaquePointer::UNINITIALIZED,

0 commit comments

Comments
 (0)