diff --git a/mmtk/Cargo.lock b/mmtk/Cargo.lock index ff16916f..6b47edfc 100644 --- a/mmtk/Cargo.lock +++ b/mmtk/Cargo.lock @@ -50,6 +50,43 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "built" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f346b6890a0dfa7266974910e7df2d5088120dd54721b9b0e5aae1ae5e05715" +dependencies = [ + "cargo-lock", + "git2", +] + +[[package]] +name = "cargo-lock" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c408da54db4c50d4693f7e649c299bc9de9c23ead86249e5368830bb32a734b" +dependencies = [ + "semver 1.0.13", + "serde", + "toml", + "url", +] + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +dependencies = [ + "jobserver", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -170,6 +207,29 @@ dependencies = [ "termcolor", ] +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "git2" +version = "0.13.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "url", +] + [[package]] name = "heck" version = "0.4.0" @@ -191,6 +251,26 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "jobserver" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +dependencies = [ + "libc", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -199,9 +279,33 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.127" +version = "0.2.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" + +[[package]] +name = "libgit2-sys" +version = "0.12.26+1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + +[[package]] +name = "libz-sys" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "505e71a4706fa491e9b1b55f51b95d4037d0821ee40131190475f692b35b009b" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] [[package]] name = "log" @@ -212,6 +316,12 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + [[package]] name = "memchr" version = "2.5.0" @@ -230,11 +340,12 @@ dependencies = [ [[package]] name = "mmtk" version = "0.14.0" -source = "git+https://github.com/mmtk/mmtk-core.git?rev=a96e8f991c91a81df51e7975849441f52fdbcdcc#a96e8f991c91a81df51e7975849441f52fdbcdcc" +source = "git+https://github.com/mmtk/mmtk-core.git?rev=76131c493be38e421f5fb157f9900f850584554f#76131c493be38e421f5fb157f9900f850584554f" dependencies = [ "atomic", "atomic-traits", "atomic_refcell", + "built", "crossbeam", "downcast-rs", "enum-map", @@ -252,7 +363,7 @@ dependencies = [ [[package]] name = "mmtk-macros" version = "0.14.0" -source = "git+https://github.com/mmtk/mmtk-core.git?rev=a96e8f991c91a81df51e7975849441f52fdbcdcc#a96e8f991c91a81df51e7975849441f52fdbcdcc" +source = "git+https://github.com/mmtk/mmtk-core.git?rev=76131c493be38e421f5fb157f9900f850584554f#76131c493be38e421f5fb157f9900f850584554f" dependencies = [ "proc-macro-error", "proc-macro2", @@ -282,9 +393,21 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.13.0" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pkg-config" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "proc-macro-error" @@ -351,7 +474,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0", ] [[package]] @@ -375,12 +498,41 @@ dependencies = [ "semver-parser", ] +[[package]] +name = "semver" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" +dependencies = [ + "serde", +] + [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "serde" +version = "1.0.144" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.144" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "spin" version = "0.5.2" @@ -426,12 +578,69 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + [[package]] name = "unicode-ident" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" +[[package]] +name = "unicode-normalization" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index cb02e94b..aba40270 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -28,7 +28,7 @@ log = {version = "0.4", features = ["max_level_trace", "release_max_level_off"] # - change branch/rev # - 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 = "a96e8f991c91a81df51e7975849441f52fdbcdcc" } +mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "76131c493be38e421f5fb157f9900f850584554f" } # Uncomment the following to build locally - if you change the path locally, do not commit the change in a PR # mmtk = { path = "../repos/mmtk-core" } diff --git a/mmtk/src/lib.rs b/mmtk/src/lib.rs index 5db69c61..8a199c51 100644 --- a/mmtk/src/lib.rs +++ b/mmtk/src/lib.rs @@ -43,6 +43,12 @@ pub static mut JTOC_BASE: Address = Address::ZERO; #[derive(Default)] pub struct JikesRVM; +/// The type of edges in JikesRVM. +/// +/// TODO: We start with Address to ease the transition. +/// We should switch to the equivalent `mmtk::vm::edge_shape::SimpleEdge` later. +pub type JikesRVMEdge = Address; + impl VMBinding for JikesRVM { type VMObjectModel = object_model::VMObjectModel; type VMScanning = scanning::VMScanning; @@ -50,6 +56,8 @@ impl VMBinding for JikesRVM { type VMActivePlan = active_plan::VMActivePlan; type VMReferenceGlue = reference_glue::VMReferenceGlue; + type VMEdge = JikesRVMEdge; + const ALLOC_END_ALIGNMENT: usize = 4; } diff --git a/mmtk/src/scan_boot_image.rs b/mmtk/src/scan_boot_image.rs index 421af68a..6907630d 100644 --- a/mmtk/src/scan_boot_image.rs +++ b/mmtk/src/scan_boot_image.rs @@ -1,6 +1,7 @@ use crate::scanning::EDGES_BUFFER_CAPACITY; use crate::unboxed_size_constants::*; use crate::JikesRVM; +use crate::JikesRVMEdge; use entrypoint::*; use java_size_constants::*; use mmtk::scheduler::*; @@ -25,7 +26,7 @@ static REFS: AtomicUsize = AtomicUsize::new(0); pub fn scan_boot_image( _tls: OpaquePointer, - factory: &mut impl RootsWorkFactory, + factory: &mut impl RootsWorkFactory, subwork_id: usize, total_subwork: usize, ) { @@ -140,13 +141,13 @@ fn decode_long_encoding(cursor: Address) -> usize { } } -pub struct ScanBootImageRoots { +pub struct ScanBootImageRoots> { factory: F, subwork_id: usize, total_subwork: usize, } -impl ScanBootImageRoots { +impl> ScanBootImageRoots { pub fn new(factory: F, subwork_id: usize, total_subwork: usize) -> Self { Self { factory, @@ -156,7 +157,7 @@ impl ScanBootImageRoots { } } -impl GCWork for ScanBootImageRoots { +impl> GCWork for ScanBootImageRoots { fn do_work(&mut self, _worker: &mut GCWorker, _mmtk: &'static MMTK) { scan_boot_image( OpaquePointer::UNINITIALIZED, diff --git a/mmtk/src/scan_statics.rs b/mmtk/src/scan_statics.rs index c141828f..8a4429b9 100644 --- a/mmtk/src/scan_statics.rs +++ b/mmtk/src/scan_statics.rs @@ -1,5 +1,6 @@ use crate::scanning::EDGES_BUFFER_CAPACITY; use crate::JikesRVM; +use crate::JikesRVMEdge; use entrypoint::*; use mmtk::scheduler::*; use mmtk::util::opaque_pointer::*; @@ -17,7 +18,7 @@ const CHUNK_SIZE_MASK: usize = 0xFFFFFFFF - (REF_SLOT_SIZE - 1); pub fn scan_statics( tls: VMWorkerThread, - factory: &mut impl RootsWorkFactory, + factory: &mut impl RootsWorkFactory, subwork_id: usize, total_subwork: usize, ) { @@ -62,13 +63,13 @@ pub fn scan_statics( } } -pub struct ScanStaticRoots { +pub struct ScanStaticRoots> { factory: F, subwork_id: usize, total_subwork: usize, } -impl ScanStaticRoots { +impl> ScanStaticRoots { pub fn new(factory: F, subwork_id: usize, total_subwork: usize) -> Self { Self { factory, @@ -78,7 +79,7 @@ impl ScanStaticRoots { } } -impl GCWork for ScanStaticRoots { +impl> GCWork for ScanStaticRoots { fn do_work(&mut self, worker: &mut GCWorker, _mmtk: &'static MMTK) { scan_statics( worker.tls, diff --git a/mmtk/src/scanning.rs b/mmtk/src/scanning.rs index bd4a9561..5c3ca1e4 100644 --- a/mmtk/src/scanning.rs +++ b/mmtk/src/scanning.rs @@ -5,6 +5,7 @@ use std::slice; // use crate::scan_boot_image::ScanBootImageRoots; use crate::scan_statics::ScanStaticRoots; use crate::unboxed_size_constants::LOG_BYTES_IN_ADDRESS; +use crate::JikesRVMEdge; use crate::SINGLETON; use active_plan::VMActivePlan; use entrypoint::*; @@ -34,7 +35,7 @@ const DUMP_REF: bool = false; // See the Java constant `RustScanThread.EDGES_BUFFER_CAPACITY`. pub(crate) const EDGES_BUFFER_CAPACITY: usize = 4096; -extern "C" fn report_edges_and_renew_buffer( +extern "C" fn report_edges_and_renew_buffer>( ptr: *mut Address, length: usize, factory: *mut F, @@ -57,17 +58,17 @@ extern "C" fn report_edges_and_renew_buffer( impl Scanning for VMScanning { const SINGLE_THREAD_MUTATOR_SCANNING: bool = false; - fn scan_thread_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) { + fn scan_thread_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) { unreachable!() } fn scan_thread_root( tls: VMWorkerThread, mutator: &'static mut Mutator, - mut factory: impl RootsWorkFactory, + mut factory: impl RootsWorkFactory, ) { Self::compute_thread_roots(&mut factory, false, mutator.get_tls(), tls); } - fn scan_vm_specific_roots(_tls: VMWorkerThread, factory: impl RootsWorkFactory) { + fn scan_vm_specific_roots(_tls: VMWorkerThread, factory: impl RootsWorkFactory) { let workers = memory_manager::num_of_workers(&SINGLETON); for i in 0..workers { memory_manager::add_work_packets( @@ -81,7 +82,7 @@ impl Scanning for VMScanning { ); } } - fn scan_object( + fn scan_object>( tls: VMWorkerThread, object: ObjectReference, edge_visitor: &mut EV, @@ -174,7 +175,7 @@ impl Scanning for VMScanning { } impl VMScanning { - fn compute_thread_roots( + fn compute_thread_roots>( factory: &mut F, new_roots_sufficient: bool, mutator: VMMutatorThread, @@ -272,13 +273,13 @@ impl VMScanning { } } -pub struct ScanGlobalRoots { +pub struct ScanGlobalRoots> { factory: F, subwork_id: usize, total_subwork: usize, } -impl ScanGlobalRoots { +impl> ScanGlobalRoots { pub fn new(factory: F, subwork_id: usize, total_subwork: usize) -> Self { Self { factory, @@ -288,7 +289,7 @@ impl ScanGlobalRoots { } } -impl GCWork for ScanGlobalRoots { +impl> GCWork for ScanGlobalRoots { fn do_work(&mut self, worker: &mut GCWorker, _mmtk: &'static MMTK) { let mut edges = Vec::with_capacity(EDGES_BUFFER_CAPACITY); VMScanning::scan_global_roots(worker.tls, self.subwork_id, self.total_subwork, |edge| {