# HG changeset patch # User zgu # Date 1407872342 25200 # Node ID d9d32aabf9412877bfc5c098d2b7a7336240793e # Parent b5c40ed1d34992fc75b4c91b64c5ae057c923ad1 8054938: [TESTBUG] Wrong WhiteBox.java was pushed by JDK-8044140 Summary: Reserved WhiteBox.java pushed by JDK-8044140 Reviewed-by: ccheung, hseigel diff -r b5c40ed1d349 -r d9d32aabf941 hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Tue Aug 12 10:48:55 2014 -0400 +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Tue Aug 12 12:39:02 2014 -0700 @@ -25,6 +25,10 @@ package sun.hotspot; import java.lang.reflect.Executable; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Stream; import java.security.BasicPermission; import sun.hotspot.parser.DiagnosticCommand; @@ -130,7 +134,7 @@ } public native int getCompileQueueSize(int compLevel); public native boolean testSetForceInlineMethod(Executable method, boolean value); - public boolean enqueueMethodForCompilation(Executable method, int compLevel) { + public boolean enqueueMethodForCompilation(Executable method, int compLevel) { return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/); } public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci); @@ -143,6 +147,8 @@ // Memory public native void readReservedMemory(); + public native long allocateMetaspace(ClassLoader classLoader, long size); + public native void freeMetaspace(ClassLoader classLoader, long addr, long size); // force Full GC public native void fullGC(); @@ -151,8 +157,34 @@ public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations); public native void runMemoryUnitTests(); public native void readFromNoaccessArea(); + public native long getThreadStackSize(); + public native long getThreadRemainingStackSize(); // CPU features public native String getCPUFeatures(); + // VM flags + public native void setBooleanVMFlag(String name, boolean value); + public native void setIntxVMFlag(String name, long value); + public native void setUintxVMFlag(String name, long value); + public native void setUint64VMFlag(String name, long value); + public native void setStringVMFlag(String name, String value); + public native void setDoubleVMFlag(String name, double value); + public native Boolean getBooleanVMFlag(String name); + public native Long getIntxVMFlag(String name); + public native Long getUintxVMFlag(String name); + public native Long getUint64VMFlag(String name); + public native String getStringVMFlag(String name); + public native Double getDoubleVMFlag(String name); + private final List> flagsGetters = Arrays.asList( + this::getBooleanVMFlag, this::getIntxVMFlag, this::getUintxVMFlag, + this::getUint64VMFlag, this::getStringVMFlag, this::getDoubleVMFlag); + + public Object getVMFlag(String name) { + return flagsGetters.stream() + .map(f -> f.apply(name)) + .filter(x -> x != null) + .findAny() + .orElse(null); + } }