Skip to content

Commit 4acb883

Browse files
Evgeny Nikitiniignatev
Evgeny Nikitin
authored andcommitted
8261666: [mlvm] Remove WhiteBoxHelper
Reviewed-by: iignatyev
1 parent 5069796 commit 4acb883

File tree

2 files changed

+4
-81
lines changed

2 files changed

+4
-81
lines changed

test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/stress/gc/lotsOfCallSites/Test.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@
6262
import java.lang.management.MemoryUsage;
6363
import java.util.HashSet;
6464

65+
import sun.hotspot.WhiteBox;
66+
6567
import nsk.share.test.Stresser;
6668
import vm.mlvm.share.CustomClassLoaders;
6769
import vm.mlvm.share.Env;
6870
import vm.mlvm.share.MlvmTest;
69-
import vm.mlvm.share.WhiteBoxHelper;
7071
import vm.share.FileUtils;
7172
import vm.share.options.Option;
7273

@@ -87,6 +88,7 @@ public class Test extends MlvmTest {
8788
@Option(name = "iterations", default_value = "100000", description = "Iterations: each iteration loads one new class")
8889
private int iterations = 100_000;
8990

91+
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
9092
private static final int GC_COUNT = 6;
9193
private static final boolean TERMINATE_ON_FULL_METASPACE = false;
9294

@@ -133,15 +135,6 @@ private MemoryPoolMXBean getClassMetadataMemoryPoolMXBean() {
133135
return null;
134136
}
135137

136-
private MethodHandle getFullGCMethod() throws NoSuchMethodException, IllegalAccessException {
137-
try {
138-
return WhiteBoxHelper.getMethod("fullGC", MethodType.methodType(void.class));
139-
} catch (NoSuchMethodException | ClassNotFoundException | InvocationTargetException e) {
140-
Env.traceDebug(e, "No WhiteBox API. Will use System.gc() instead of WhiteBox.fullGC()");
141-
return MethodHandles.lookup().findStatic(System.class, "gc", MethodType.methodType(void.class));
142-
}
143-
}
144-
145138
@Override
146139
public boolean run() throws Throwable {
147140
setHeapDumpAfter(heapDumpOpt);
@@ -150,8 +143,6 @@ public boolean run() throws Throwable {
150143
final MemoryPoolMXBean classMetadataPoolMXB = getClassMetadataMemoryPoolMXBean();
151144
final String memPoolName = classMetadataPoolMXB == null ? "" : classMetadataPoolMXB.getName();
152145

153-
MethodHandle mhCollectHeap = getFullGCMethod();
154-
155146
int removedEntries = 0;
156147

157148
Stresser stresser = createStresser();
@@ -183,7 +174,7 @@ public boolean run() throws Throwable {
183174
}
184175

185176
for (int i = 0; i < GC_COUNT; ++i) {
186-
mhCollectHeap.invoke();
177+
WHITE_BOX.fullGC();
187178
Thread.sleep(500);
188179
removedEntries += removeQueuedReferences();
189180
}

test/hotspot/jtreg/vmTestbase/vm/mlvm/share/WhiteBoxHelper.java

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)