251 }
252
253 /**
254 * @return true if VM runs in emulated-client mode and false otherwise.
255 */
256 protected String vmEmulatedClient() {
257 String vmInfo = System.getProperty("java.vm.info");
258 if (vmInfo == null) {
259 return errorWithMessage("Can't get 'java.vm.info' property");
260 }
261 return "" + vmInfo.contains(" emulated-client");
262 }
263
264 /**
265 * @return supported CPU features
266 */
267 protected String cpuFeatures() {
268 return CPUInfo.getFeatures().toString();
269 }
270
271 /**
272 * For all existing GC sets vm.gc.X property.
273 * Example vm.gc.G1=true means:
274 * VM supports G1
275 * User either set G1 explicitely (-XX:+UseG1GC) or did not set any GC
276 *
277 * @param map - property-value pairs
278 */
279 protected void vmGC(SafeMap map) {
280 for (GC gc: GC.values()) {
281 map.put("vm.gc." + gc.name(),
282 () -> "" + (gc.isSupported()
283 && (gc.isSelected() || GC.isSelectedErgonomically())));
284 }
285 }
286
287 /**
288 * Selected final flag.
289 *
290 * @param map - property-value pairs
291 * @param flagName - flag name
292 */
293 private void vmOptFinalFlag(SafeMap map, String flagName) {
294 map.put("vm.opt.final." + flagName,
295 () -> String.valueOf(WB.getBooleanVMFlag(flagName)));
296 }
297
298 /**
299 * Selected sets of final flags.
300 *
301 * @param map - property-value pairs
302 */
303 protected void vmOptFinalFlags(SafeMap map) {
304 vmOptFinalFlag(map, "ClassUnloading");
305 vmOptFinalFlag(map, "ClassUnloadingWithConcurrentMark");
306 vmOptFinalFlag(map, "UseCompressedOops");
|
251 }
252
253 /**
254 * @return true if VM runs in emulated-client mode and false otherwise.
255 */
256 protected String vmEmulatedClient() {
257 String vmInfo = System.getProperty("java.vm.info");
258 if (vmInfo == null) {
259 return errorWithMessage("Can't get 'java.vm.info' property");
260 }
261 return "" + vmInfo.contains(" emulated-client");
262 }
263
264 /**
265 * @return supported CPU features
266 */
267 protected String cpuFeatures() {
268 return CPUInfo.getFeatures().toString();
269 }
270
271 private boolean isGcSupportedByGraal(GC gc) {
272 switch (gc) {
273 case Serial:
274 case Parallel:
275 case G1:
276 return true;
277 case Epsilon:
278 case Z:
279 case Shenandoah:
280 return false;
281 default:
282 throw new IllegalStateException("Unknown GC " + gc.name());
283 }
284 }
285
286 /**
287 * For all existing GC sets vm.gc.X property.
288 * Example vm.gc.G1=true means:
289 * VM supports G1
290 * User either set G1 explicitely (-XX:+UseG1GC) or did not set any GC
291 * G1 can be selected, i.e. it doesn't conflict with other VM flags
292 *
293 * @param map - property-value pairs
294 */
295 protected void vmGC(SafeMap map) {
296 var isGraalEnabled = Compiler.isGraalEnabled();
297 for (GC gc: GC.values()) {
298 map.put("vm.gc." + gc.name(),
299 () -> "" + (gc.isSupported()
300 && (!isGraalEnabled || isGcSupportedByGraal(gc))
301 && (gc.isSelected() || GC.isSelectedErgonomically())));
302 }
303 }
304
305
306 /**
307 * Selected final flag.
308 *
309 * @param map - property-value pairs
310 * @param flagName - flag name
311 */
312 private void vmOptFinalFlag(SafeMap map, String flagName) {
313 map.put("vm.opt.final." + flagName,
314 () -> String.valueOf(WB.getBooleanVMFlag(flagName)));
315 }
316
317 /**
318 * Selected sets of final flags.
319 *
320 * @param map - property-value pairs
321 */
322 protected void vmOptFinalFlags(SafeMap map) {
323 vmOptFinalFlag(map, "ClassUnloading");
324 vmOptFinalFlag(map, "ClassUnloadingWithConcurrentMark");
325 vmOptFinalFlag(map, "UseCompressedOops");
|