From a86765cb7cef4583057ac5423897ec5a1b02f0fc Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Thu, 17 Jul 2025 10:35:39 +0200 Subject: [PATCH 1/2] Use WhiteBox::fullGC instead of System::gc --- .../HeapDump/UnmountedVThreadNativeMethodAtTop.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java b/test/hotspot/jtreg/serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java index bb08be91dac17..fa36ac3fa69a4 100644 --- a/test/hotspot/jtreg/serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java +++ b/test/hotspot/jtreg/serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java @@ -27,7 +27,9 @@ * @requires vm.continuations * @modules jdk.management * @library /test/lib - * @run junit/othervm --enable-native-access=ALL-UNNAMED UnmountedVThreadNativeMethodAtTop + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run junit/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI --enable-native-access=ALL-UNNAMED UnmountedVThreadNativeMethodAtTop */ import java.lang.management.ManagementFactory; @@ -45,9 +47,12 @@ import jdk.test.lib.hprof.model.Snapshot; import jdk.test.lib.hprof.model.ThreadObject; import jdk.test.lib.hprof.parser.Reader; +import jdk.test.whitebox.WhiteBox; public class UnmountedVThreadNativeMethodAtTop { + static WhiteBox wb = WhiteBox.getWhiteBox(); + boolean done; /** @@ -56,7 +61,7 @@ public class UnmountedVThreadNativeMethodAtTop { */ @BeforeEach void doGC() { - System.gc(); + wb.fullGC(); } /** From 6c7166617f0877f35078295d1175cd812078681d Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Thu, 17 Jul 2025 14:52:54 +0200 Subject: [PATCH 2/2] Use /native option --- .../HeapDump/UnmountedVThreadNativeMethodAtTop.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java b/test/hotspot/jtreg/serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java index fa36ac3fa69a4..7980b5ae28d0a 100644 --- a/test/hotspot/jtreg/serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java +++ b/test/hotspot/jtreg/serviceability/HeapDump/UnmountedVThreadNativeMethodAtTop.java @@ -29,7 +29,7 @@ * @library /test/lib * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run junit/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI --enable-native-access=ALL-UNNAMED UnmountedVThreadNativeMethodAtTop + * @run junit/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI --enable-native-access=ALL-UNNAMED UnmountedVThreadNativeMethodAtTop */ import java.lang.management.ManagementFactory;