From 973b6d268883f3a01e703674d36c8a917449077f Mon Sep 17 00:00:00 2001 From: Kunshan Wang Date: Mon, 29 Aug 2022 14:40:19 +0800 Subject: [PATCH] Use the new API with Edge trait (#66) --- mmtk/Cargo.lock | 223 +++++++++++++++++++++++++++++++++++++++++-- mmtk/Cargo.toml | 2 +- mmtk/src/lib.rs | 9 ++ mmtk/src/scanning.rs | 9 +- 4 files changed, 231 insertions(+), 12 deletions(-) diff --git a/mmtk/Cargo.lock b/mmtk/Cargo.lock index 69e9ee3..3701d0d 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 61c033b..4dbc472 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -27,7 +27,7 @@ log = "*" # - 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 = "a96e8f991c91a81df51e7975849441f52fdbcdcc" } +mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "76131c493be38e421f5fb157f9900f850584554f" } # Uncomment the following and fix the path to mmtk-core to build locally # mmtk = { path = "../repos/mmtk-core" } diff --git a/mmtk/src/lib.rs b/mmtk/src/lib.rs index ebecc37..477c488 100644 --- a/mmtk/src/lib.rs +++ b/mmtk/src/lib.rs @@ -10,6 +10,7 @@ use std::ptr::null_mut; use libc::c_void; use mmtk::util::opaque_pointer::*; +use mmtk::util::Address; use mmtk::util::ObjectReference; use mmtk::vm::VMBinding; use mmtk::MMTKBuilder; @@ -46,6 +47,12 @@ pub static mut UPCALLS: *const V8_Upcalls = null_mut(); #[derive(Default)] pub struct V8; +/// The edge type of V8. +/// +/// TODO: We start with Address to transition from the old API. +/// We should define an edge type suitable for V8. +pub type V8Edge = Address; + impl VMBinding for V8 { type VMObjectModel = object_model::VMObjectModel; type VMScanning = scanning::VMScanning; @@ -53,6 +60,8 @@ impl VMBinding for V8 { type VMActivePlan = active_plan::VMActivePlan; type VMReferenceGlue = reference_glue::VMReferenceGlue; + type VMEdge = V8Edge; + const MAX_ALIGNMENT: usize = 32; } diff --git a/mmtk/src/scanning.rs b/mmtk/src/scanning.rs index 2f110d8..257fcf1 100644 --- a/mmtk/src/scanning.rs +++ b/mmtk/src/scanning.rs @@ -5,6 +5,7 @@ use mmtk::vm::RootsWorkFactory; use mmtk::vm::Scanning; use mmtk::Mutator; use V8; +use V8Edge; pub struct VMScanning {} @@ -12,7 +13,7 @@ impl Scanning for VMScanning { const SCAN_MUTATORS_IN_SAFEPOINT: bool = false; const SINGLE_THREAD_MUTATOR_SCANNING: bool = false; - fn scan_object( + fn scan_object>( _tls: VMWorkerThread, _object: ObjectReference, _edge_visitor: &mut EV, @@ -24,19 +25,19 @@ impl Scanning for VMScanning { unimplemented!() } - fn scan_thread_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) { + fn scan_thread_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) { unimplemented!() } fn scan_thread_root( _tls: VMWorkerThread, _mutator: &'static mut Mutator, - _factory: impl RootsWorkFactory, + _factory: impl RootsWorkFactory, ) { unimplemented!() } - fn scan_vm_specific_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) { + fn scan_vm_specific_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) { unimplemented!() }