--- old/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java 2014-11-06 14:34:12.737813458 +0400 +++ new/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java 2014-11-06 14:34:12.494427792 +0400 @@ -24,8 +24,10 @@ import com.oracle.testlibrary.jsr292.Helper; import com.sun.management.HotSpotDiagnosticMXBean; import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.lang.reflect.Method; import java.util.Collection; +import java.util.List; import java.util.function.Function; /** @@ -95,27 +97,34 @@ long iterations = Math.max(1, Helper.TEST_LIMIT / testCaseNum); System.out.printf("Number of iterations according to -DtestLimit is %d (%d cases)%n", iterations, iterations * testCaseNum); - HotSpotDiagnosticMXBean hsDiagBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); - long codeCacheSize = Long.parseLong( - hsDiagBean.getVMOption("ReservedCodeCacheSize").getValue()); - System.out.printf("Code cache size is %d bytes%n", codeCacheSize); - long iterationsByCodeCacheSize = (long) (codeCacheSize - * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO); - long nonProfiledCodeCacheSize = Long.parseLong( - hsDiagBean.getVMOption("NonProfiledCodeHeapSize").getValue()); - System.out.printf("Non-profiled code cache size is %d bytes%n", nonProfiledCodeCacheSize); - long iterationsByNonProfiledCodeCacheSize = (long) (nonProfiledCodeCacheSize - * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO); - System.out.printf("Number of iterations limited by code cache size is %d (%d cases)%n", - iterationsByCodeCacheSize, iterationsByCodeCacheSize * testCaseNum); - System.out.printf("Number of iterations limited by non-profiled code cache size is %d (%d cases)%n", - iterationsByNonProfiledCodeCacheSize, iterationsByNonProfiledCodeCacheSize * testCaseNum); - iterations = Math.min(iterationsByCodeCacheSize, - Math.min(iterations, iterationsByNonProfiledCodeCacheSize)); - if (iterations == 0) { - System.out.println("Warning: code cache size is too small to provide at" - + " least one iteration! Test will try to do one iteration."); + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List vmopts = runtimeMxBean.getInputArguments(); + if (vmopts.contains("-Xcomp")) { + System.out.println("Number of iterations is limited to 1 because -Xcomp is set"); iterations = 1; + } else { + HotSpotDiagnosticMXBean hsDiagBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); + long codeCacheSize = Long.parseLong( + hsDiagBean.getVMOption("ReservedCodeCacheSize").getValue()); + System.out.printf("Code cache size is %d bytes%n", codeCacheSize); + long iterationsByCodeCacheSize = (long) (codeCacheSize + * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO); + long nonProfiledCodeCacheSize = Long.parseLong( + hsDiagBean.getVMOption("NonProfiledCodeHeapSize").getValue()); + System.out.printf("Non-profiled code cache size is %d bytes%n", nonProfiledCodeCacheSize); + long iterationsByNonProfiledCodeCacheSize = (long) (nonProfiledCodeCacheSize + * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO); + System.out.printf("Number of iterations limited by code cache size is %d (%d cases)%n", + iterationsByCodeCacheSize, iterationsByCodeCacheSize * testCaseNum); + System.out.printf("Number of iterations limited by non-profiled code cache size is %d (%d cases)%n", + iterationsByNonProfiledCodeCacheSize, iterationsByNonProfiledCodeCacheSize * testCaseNum); + iterations = Math.min(iterationsByCodeCacheSize, + Math.min(iterations, iterationsByNonProfiledCodeCacheSize)); + if (iterations == 0) { + System.out.println("Warning: code cache size is too small to provide at" + + " least one iteration! Test will try to do one iteration."); + iterations = 1; + } } System.out.printf("Number of iterations is set to %d (%d cases)%n", iterations, iterations * testCaseNum);