From cca23c5356867b537d08f0331398bd900a19f264 Mon Sep 17 00:00:00 2001 From: Yi Lin Date: Tue, 12 Aug 2025 01:32:14 +0000 Subject: [PATCH 1/6] Test MMTk core PR #1364 --- mmtk/Cargo.lock | 4 ++-- mmtk/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mmtk/Cargo.lock b/mmtk/Cargo.lock index c74bc311..ad062c76 100644 --- a/mmtk/Cargo.lock +++ b/mmtk/Cargo.lock @@ -459,7 +459,7 @@ dependencies = [ [[package]] name = "mmtk" version = "0.31.0" -source = "git+https://github.com/mmtk/mmtk-core.git?rev=7d798ad8a71aa6df80f58f5e565e4f9274d06871#7d798ad8a71aa6df80f58f5e565e4f9274d06871" +source = "git+https://github.com/qinsoon/mmtk-core.git?rev=9c7695cc90a88ccec63a66584f416759d9e1f901#9c7695cc90a88ccec63a66584f416759d9e1f901" dependencies = [ "atomic", "atomic-traits", @@ -497,7 +497,7 @@ dependencies = [ [[package]] name = "mmtk-macros" version = "0.31.0" -source = "git+https://github.com/mmtk/mmtk-core.git?rev=7d798ad8a71aa6df80f58f5e565e4f9274d06871#7d798ad8a71aa6df80f58f5e565e4f9274d06871" +source = "git+https://github.com/qinsoon/mmtk-core.git?rev=9c7695cc90a88ccec63a66584f416759d9e1f901#9c7695cc90a88ccec63a66584f416759d9e1f901" dependencies = [ "proc-macro-error", "proc-macro2", diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index 6a33a938..cf1d608d 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -35,7 +35,7 @@ probe = "0.5" # - 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 = "7d798ad8a71aa6df80f58f5e565e4f9274d06871" } +mmtk = { git = "https://github.com/qinsoon/mmtk-core.git", rev = "9c7695cc90a88ccec63a66584f416759d9e1f901" } # Uncomment the following to build locally # mmtk = { path = "../repos/mmtk-core" } From 029dcf981096fff6b79850a851444855518bfb0f Mon Sep 17 00:00:00 2001 From: Yi Lin Date: Wed, 13 Aug 2025 01:48:24 +0000 Subject: [PATCH 2/6] Update mmtk-core --- mmtk/Cargo.lock | 4 ++-- mmtk/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mmtk/Cargo.lock b/mmtk/Cargo.lock index ad062c76..030766f1 100644 --- a/mmtk/Cargo.lock +++ b/mmtk/Cargo.lock @@ -459,7 +459,7 @@ dependencies = [ [[package]] name = "mmtk" version = "0.31.0" -source = "git+https://github.com/qinsoon/mmtk-core.git?rev=9c7695cc90a88ccec63a66584f416759d9e1f901#9c7695cc90a88ccec63a66584f416759d9e1f901" +source = "git+https://github.com/qinsoon/mmtk-core.git?rev=6149721e29678bbd164b461964c4a5d81d7c57bf#6149721e29678bbd164b461964c4a5d81d7c57bf" dependencies = [ "atomic", "atomic-traits", @@ -497,7 +497,7 @@ dependencies = [ [[package]] name = "mmtk-macros" version = "0.31.0" -source = "git+https://github.com/qinsoon/mmtk-core.git?rev=9c7695cc90a88ccec63a66584f416759d9e1f901#9c7695cc90a88ccec63a66584f416759d9e1f901" +source = "git+https://github.com/qinsoon/mmtk-core.git?rev=6149721e29678bbd164b461964c4a5d81d7c57bf#6149721e29678bbd164b461964c4a5d81d7c57bf" dependencies = [ "proc-macro-error", "proc-macro2", diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index cf1d608d..a990a846 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -35,7 +35,7 @@ probe = "0.5" # - change branch # - change repo name # But other changes including adding/removing whitespaces in commented lines may break the CI. -mmtk = { git = "https://github.com/qinsoon/mmtk-core.git", rev = "9c7695cc90a88ccec63a66584f416759d9e1f901" } +mmtk = { git = "https://github.com/qinsoon/mmtk-core.git", rev = "6149721e29678bbd164b461964c4a5d81d7c57bf" } # Uncomment the following to build locally # mmtk = { path = "../repos/mmtk-core" } From bae466cdaf575b21915d6c2e479bf4d516d5e7e5 Mon Sep 17 00:00:00 2001 From: Yi Lin Date: Thu, 14 Aug 2025 03:53:22 +0000 Subject: [PATCH 3/6] Update mmtk-core --- mmtk/Cargo.lock | 5 +++-- mmtk/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mmtk/Cargo.lock b/mmtk/Cargo.lock index 030766f1..a971e790 100644 --- a/mmtk/Cargo.lock +++ b/mmtk/Cargo.lock @@ -459,7 +459,7 @@ dependencies = [ [[package]] name = "mmtk" version = "0.31.0" -source = "git+https://github.com/qinsoon/mmtk-core.git?rev=6149721e29678bbd164b461964c4a5d81d7c57bf#6149721e29678bbd164b461964c4a5d81d7c57bf" +source = "git+https://github.com/qinsoon/mmtk-core.git?rev=cabdd668972fb883e05385ce94259e3b01357798#cabdd668972fb883e05385ce94259e3b01357798" dependencies = [ "atomic", "atomic-traits", @@ -485,6 +485,7 @@ dependencies = [ "num_cpus", "portable-atomic", "probe", + "rayon-core", "regex", "rustversion", "spin", @@ -497,7 +498,7 @@ dependencies = [ [[package]] name = "mmtk-macros" version = "0.31.0" -source = "git+https://github.com/qinsoon/mmtk-core.git?rev=6149721e29678bbd164b461964c4a5d81d7c57bf#6149721e29678bbd164b461964c4a5d81d7c57bf" +source = "git+https://github.com/qinsoon/mmtk-core.git?rev=cabdd668972fb883e05385ce94259e3b01357798#cabdd668972fb883e05385ce94259e3b01357798" dependencies = [ "proc-macro-error", "proc-macro2", diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index a990a846..dc9ff4de 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -35,7 +35,7 @@ probe = "0.5" # - change branch # - change repo name # But other changes including adding/removing whitespaces in commented lines may break the CI. -mmtk = { git = "https://github.com/qinsoon/mmtk-core.git", rev = "6149721e29678bbd164b461964c4a5d81d7c57bf" } +mmtk = { git = "https://github.com/qinsoon/mmtk-core.git", rev = "cabdd668972fb883e05385ce94259e3b01357798" } # Uncomment the following to build locally # mmtk = { path = "../repos/mmtk-core" } From db3a10f3475e515ad60160384fa20c7debf87c78 Mon Sep 17 00:00:00 2001 From: Yi Lin Date: Fri, 15 Aug 2025 00:05:47 +0000 Subject: [PATCH 4/6] set up tmate session --- .github/workflows/run-dacapo-2006.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-dacapo-2006.yml b/.github/workflows/run-dacapo-2006.yml index 5985afe0..a3f011ce 100644 --- a/.github/workflows/run-dacapo-2006.yml +++ b/.github/workflows/run-dacapo-2006.yml @@ -73,6 +73,8 @@ jobs: BIN_DIR=`find . -name bin` mv `dirname $BIN_DIR` jdk popd + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 - name: Test ${{ matrix.test-script }} run: | export TEST_JAVA_BIN=$GITHUB_WORKSPACE/bundles/jdk/bin/java From a6d8978efaec9de09561c65199c4cb68d1714f8c Mon Sep 17 00:00:00 2001 From: Yi Lin Date: Fri, 15 Aug 2025 04:21:57 +0000 Subject: [PATCH 5/6] Acquire and release heap lock on VM_MMTkSTWOperation --- openjdk/mmtkUpcalls.cpp | 12 ------------ openjdk/mmtkVMOperation.cpp | 13 +++++++++++++ openjdk/mmtkVMOperation.hpp | 2 ++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/openjdk/mmtkUpcalls.cpp b/openjdk/mmtkUpcalls.cpp index c665a191..fd90cf0e 100644 --- a/openjdk/mmtkUpcalls.cpp +++ b/openjdk/mmtkUpcalls.cpp @@ -87,15 +87,6 @@ static void mmtk_resume_mutators(void *tls) { MutexLockerEx locker(MMTkHeap::heap()->gc_lock(), Mutex::_no_safepoint_check_flag); MMTkHeap::heap()->gc_lock()->notify_all(); } - - log_debug(gc)("Notifying mutators blocking on Heap_lock for reference pending list..."); - // Note: That's the ReferenceHandler thread. - { - MutexLockerEx x(Heap_lock, Mutex::_no_safepoint_check_flag); - if (Universe::has_reference_pending_list()) { - Heap_lock->notify_all(); - } - } } static const int GC_THREAD_KIND_WORKER = 1; @@ -302,8 +293,6 @@ static void mmtk_enqueue_references(void** objects, size_t len) { return; } - MutexLocker x(Heap_lock); - oop first = (oop) objects[0]; // This points to the first node of the linked list. oop last = first; // This points to the last node of the linked list. @@ -324,7 +313,6 @@ static void mmtk_enqueue_references(void** objects, size_t len) { oop old_first = Universe::swap_reference_pending_list(first); HeapAccess::oop_store_at(last, java_lang_ref_Reference::discovered_offset, old_first); - assert(Universe::has_reference_pending_list(), "Reference pending list is empty after swap"); } OpenJDK_Upcalls mmtk_upcalls = { diff --git a/openjdk/mmtkVMOperation.cpp b/openjdk/mmtkVMOperation.cpp index 51227ee3..7ba6053f 100644 --- a/openjdk/mmtkVMOperation.cpp +++ b/openjdk/mmtkVMOperation.cpp @@ -32,8 +32,21 @@ VM_MMTkSTWOperation::VM_MMTkSTWOperation(MMTkVMCompanionThread *companion_thread _companion_thread(companion_thread) { } +bool VM_MMTkSTWOperation::doit_prologue() { + Heap_lock->lock(); + return true; +} + void VM_MMTkSTWOperation::doit() { log_trace(vmthread)("Entered VM_MMTkSTWOperation::doit()."); _companion_thread->do_mmtk_stw_operation(); log_trace(vmthread)("Leaving VM_MMTkSTWOperation::doit()"); } + +void VM_MMTkSTWOperation::doit_epilogue() { + // Notify the reference processing thread + if (Universe::has_reference_pending_list()) { + Heap_lock->notify_all(); + } + Heap_lock->unlock(); +} diff --git a/openjdk/mmtkVMOperation.hpp b/openjdk/mmtkVMOperation.hpp index 98d37ea4..49897ce7 100644 --- a/openjdk/mmtkVMOperation.hpp +++ b/openjdk/mmtkVMOperation.hpp @@ -39,7 +39,9 @@ class VM_MMTkSTWOperation : public VM_MMTkOperation { public: VM_MMTkSTWOperation(MMTkVMCompanionThread *companion_thread); + virtual bool doit_prologue() override; virtual void doit() override; + virtual void doit_epilogue() override; }; #endif // MMTK_OPENJDK_MMTK_VM_OPERATION_HPP From 4cfb11e35cc28ba32c993d4551629445a07978fc Mon Sep 17 00:00:00 2001 From: Yi Lin Date: Fri, 15 Aug 2025 04:41:55 +0000 Subject: [PATCH 6/6] Revert "set up tmate session" This reverts commit db3a10f3475e515ad60160384fa20c7debf87c78. --- .github/workflows/run-dacapo-2006.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/run-dacapo-2006.yml b/.github/workflows/run-dacapo-2006.yml index a3f011ce..5985afe0 100644 --- a/.github/workflows/run-dacapo-2006.yml +++ b/.github/workflows/run-dacapo-2006.yml @@ -73,8 +73,6 @@ jobs: BIN_DIR=`find . -name bin` mv `dirname $BIN_DIR` jdk popd - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - name: Test ${{ matrix.test-script }} run: | export TEST_JAVA_BIN=$GITHUB_WORKSPACE/bundles/jdk/bin/java