Mercurial > hg > truffle
comparison test/testlibrary/whitebox/sun/hotspot/WhiteBox.java @ 20362:f433f37645e5
8054938: [TESTBUG] Wrong WhiteBox.java was pushed by JDK-8044140
Summary: Reserved WhiteBox.java pushed by JDK-8044140
Reviewed-by: ccheung, hseigel
author | zgu |
---|---|
date | Tue, 12 Aug 2014 12:39:02 -0700 |
parents | ac12996df59b |
children | e2452c3ff7fb |
comparison
equal
deleted
inserted
replaced
20361:ac12996df59b | 20362:f433f37645e5 |
---|---|
23 */ | 23 */ |
24 | 24 |
25 package sun.hotspot; | 25 package sun.hotspot; |
26 | 26 |
27 import java.lang.reflect.Executable; | 27 import java.lang.reflect.Executable; |
28 import java.util.Arrays; | |
29 import java.util.List; | |
30 import java.util.function.Function; | |
31 import java.util.stream.Stream; | |
28 import java.security.BasicPermission; | 32 import java.security.BasicPermission; |
29 import sun.hotspot.parser.DiagnosticCommand; | 33 import sun.hotspot.parser.DiagnosticCommand; |
30 | 34 |
31 public class WhiteBox { | 35 public class WhiteBox { |
32 | 36 |
130 public int getCompileQueuesSize() { | 134 public int getCompileQueuesSize() { |
131 return getCompileQueueSize(-1 /*any*/); | 135 return getCompileQueueSize(-1 /*any*/); |
132 } | 136 } |
133 public native int getCompileQueueSize(int compLevel); | 137 public native int getCompileQueueSize(int compLevel); |
134 public native boolean testSetForceInlineMethod(Executable method, boolean value); | 138 public native boolean testSetForceInlineMethod(Executable method, boolean value); |
135 public boolean enqueueMethodForCompilation(Executable method, int compLevel) { | 139 public boolean enqueueMethodForCompilation(Executable method, int compLevel) { |
136 return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/); | 140 return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/); |
137 } | 141 } |
138 public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci); | 142 public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci); |
139 public native void clearMethodState(Executable method); | 143 public native void clearMethodState(Executable method); |
140 public native int getMethodEntryBci(Executable method); | 144 public native int getMethodEntryBci(Executable method); |
143 // Intered strings | 147 // Intered strings |
144 public native boolean isInStringTable(String str); | 148 public native boolean isInStringTable(String str); |
145 | 149 |
146 // Memory | 150 // Memory |
147 public native void readReservedMemory(); | 151 public native void readReservedMemory(); |
152 public native long allocateMetaspace(ClassLoader classLoader, long size); | |
153 public native void freeMetaspace(ClassLoader classLoader, long addr, long size); | |
148 | 154 |
149 // force Young GC | 155 // force Young GC |
150 public native void youngGC(); | 156 public native void youngGC(); |
151 | 157 |
152 // force Full GC | 158 // force Full GC |
154 | 160 |
155 // Tests on ReservedSpace/VirtualSpace classes | 161 // Tests on ReservedSpace/VirtualSpace classes |
156 public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations); | 162 public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations); |
157 public native void runMemoryUnitTests(); | 163 public native void runMemoryUnitTests(); |
158 public native void readFromNoaccessArea(); | 164 public native void readFromNoaccessArea(); |
165 public native long getThreadStackSize(); | |
166 public native long getThreadRemainingStackSize(); | |
159 | 167 |
160 // CPU features | 168 // CPU features |
161 public native String getCPUFeatures(); | 169 public native String getCPUFeatures(); |
162 | 170 |
171 // VM flags | |
172 public native void setBooleanVMFlag(String name, boolean value); | |
173 public native void setIntxVMFlag(String name, long value); | |
174 public native void setUintxVMFlag(String name, long value); | |
175 public native void setUint64VMFlag(String name, long value); | |
176 public native void setStringVMFlag(String name, String value); | |
177 public native void setDoubleVMFlag(String name, double value); | |
178 public native Boolean getBooleanVMFlag(String name); | |
179 public native Long getIntxVMFlag(String name); | |
180 public native Long getUintxVMFlag(String name); | |
181 public native Long getUint64VMFlag(String name); | |
182 public native String getStringVMFlag(String name); | |
183 public native Double getDoubleVMFlag(String name); | |
184 private final List<Function<String,Object>> flagsGetters = Arrays.asList( | |
185 this::getBooleanVMFlag, this::getIntxVMFlag, this::getUintxVMFlag, | |
186 this::getUint64VMFlag, this::getStringVMFlag, this::getDoubleVMFlag); | |
187 | |
188 public Object getVMFlag(String name) { | |
189 return flagsGetters.stream() | |
190 .map(f -> f.apply(name)) | |
191 .filter(x -> x != null) | |
192 .findAny() | |
193 .orElse(null); | |
194 } | |
163 } | 195 } |