From fbdc1416b0eb3d1c810a03917d7c2cad1fb2dcb1 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Fri, 1 Aug 2025 11:37:15 +0200 Subject: [PATCH 1/2] 8364503 Hi all, please review this change to the `gc/g1/TestCodeCacheUnloadDuringConcCycle.java` test - previously, the GC that we were waiting for in the test could occur between releasing whitebox control and the marker we use to distinguish before/after test setup. The change makes sure the marker is printed before releasing Whitebox control. Testing: Thanks, Thomas --- .../jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java b/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java index 94f65a4328f6e..22cfc51ccebee 100644 --- a/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java +++ b/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java @@ -147,6 +147,7 @@ private static void triggerCodeCacheGC() throws Exception { } public static void main(String[] args) throws Exception { + System.out.println("Running to breakpoint: " + args[0]); try { WB.concurrentGCAcquireControl(); WB.concurrentGCRunTo(args[0]); @@ -157,9 +158,13 @@ public static void main(String[] args) throws Exception { WB.concurrentGCRunToIdle(); } finally { + // Make sure that the marker we use to find the expected log message is printed + // before we release whitebox control, i.e. before the expected garbage collection + // can start. + System.out.println(TestCodeCacheUnloadDuringConcCycle.AFTER_FIRST_CYCLE_MARKER); + System.out.flush(); WB.concurrentGCReleaseControl(); } - System.out.println(TestCodeCacheUnloadDuringConcCycle.AFTER_FIRST_CYCLE_MARKER); Thread.sleep(1000); triggerCodeCacheGC(); } From 3ff76be7fa05020fc48c39fa35fa279221ae3f50 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 4 Aug 2025 09:59:20 +0200 Subject: [PATCH 2/2] * review ayang --- test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java | 1 - 1 file changed, 1 deletion(-) diff --git a/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java b/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java index 22cfc51ccebee..a4fadc185d22d 100644 --- a/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java +++ b/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java @@ -162,7 +162,6 @@ public static void main(String[] args) throws Exception { // before we release whitebox control, i.e. before the expected garbage collection // can start. System.out.println(TestCodeCacheUnloadDuringConcCycle.AFTER_FIRST_CYCLE_MARKER); - System.out.flush(); WB.concurrentGCReleaseControl(); } Thread.sleep(1000);