Skip to content
Permalink
Browse files
8261666: [mlvm] Remove WhiteBoxHelper
Reviewed-by: iignatyev
  • Loading branch information
Evgeny Nikitin authored and iignatev committed Mar 17, 2021
1 parent 5069796 commit 4acb88396ef5192ad829554b2616f498c7406cba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 81 deletions.
@@ -62,11 +62,12 @@
import java.lang.management.MemoryUsage;
import java.util.HashSet;

import sun.hotspot.WhiteBox;

import nsk.share.test.Stresser;
import vm.mlvm.share.CustomClassLoaders;
import vm.mlvm.share.Env;
import vm.mlvm.share.MlvmTest;
import vm.mlvm.share.WhiteBoxHelper;
import vm.share.FileUtils;
import vm.share.options.Option;

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

private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
private static final int GC_COUNT = 6;
private static final boolean TERMINATE_ON_FULL_METASPACE = false;

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

private MethodHandle getFullGCMethod() throws NoSuchMethodException, IllegalAccessException {
try {
return WhiteBoxHelper.getMethod("fullGC", MethodType.methodType(void.class));
} catch (NoSuchMethodException | ClassNotFoundException | InvocationTargetException e) {
Env.traceDebug(e, "No WhiteBox API. Will use System.gc() instead of WhiteBox.fullGC()");
return MethodHandles.lookup().findStatic(System.class, "gc", MethodType.methodType(void.class));
}
}

@Override
public boolean run() throws Throwable {
setHeapDumpAfter(heapDumpOpt);
@@ -150,8 +143,6 @@ public boolean run() throws Throwable {
final MemoryPoolMXBean classMetadataPoolMXB = getClassMetadataMemoryPoolMXBean();
final String memPoolName = classMetadataPoolMXB == null ? "" : classMetadataPoolMXB.getName();

MethodHandle mhCollectHeap = getFullGCMethod();

int removedEntries = 0;

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

for (int i = 0; i < GC_COUNT; ++i) {
mhCollectHeap.invoke();
WHITE_BOX.fullGC();
Thread.sleep(500);
removedEntries += removeQueuedReferences();
}

This file was deleted.

0 comments on commit 4acb883

Please sign in to comment.