--- old/test/compiler/whitebox/CompilerWhiteBoxTest.java 2014-10-03 10:52:56.901644473 +0200 +++ new/test/compiler/whitebox/CompilerWhiteBoxTest.java 2014-10-03 10:52:56.305644493 +0200 @@ -69,17 +69,21 @@ /** Flag for verbose output, true if {@code -Dverbose} specified */ protected static final boolean IS_VERBOSE = System.getProperty("verbose") != null; - /** count of invocation to triger compilation */ + /** invocation count to trigger compilation */ protected static final int THRESHOLD; - /** count of invocation to triger OSR compilation */ + /** invocation count to trigger OSR compilation */ protected static final long BACKEDGE_THRESHOLD; + /** invocation count to warm up method before triggering OSR compilation */ + protected static final long OSR_WARMUP; /** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */ protected static final String MODE = System.getProperty("java.vm.info"); static { if (TIERED_COMPILATION) { + OSR_WARMUP = 200; BACKEDGE_THRESHOLD = THRESHOLD = 150000; } else { + OSR_WARMUP = 2000; THRESHOLD = COMPILE_THRESHOLD; BACKEDGE_THRESHOLD = COMPILE_THRESHOLD * Long.parseLong(getVMOption( "OnStackReplacePercentage")); @@ -483,7 +487,8 @@ = new Callable() { @Override public Integer call() throws Exception { - return new Helper(null).hashCode(); + int result = warmup(OSR_CONSTRUCTOR); + return result + new Helper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode(); } }; @@ -493,7 +498,8 @@ @Override public Integer call() throws Exception { - return helper.osrMethod(); + int result = warmup(OSR_METHOD); + return result + helper.osrMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD); } }; @@ -501,10 +507,50 @@ = new Callable() { @Override public Integer call() throws Exception { - return osrStaticMethod(); + int result = warmup(OSR_STATIC); + return result + osrStaticMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD); } }; + /** + * Executes the method multiple times to make sure we have + * enough profiling information before triggering an OSR + * compilation. Otherwise the C2 compiler may add uncommon traps. + * + * @param m Method to be executed + * @return Number of times the method was executed + * @throws Exception + */ + private static int warmup(Method m) throws Exception { + Helper helper = new Helper(); + int result = 0; + for (long i = 0; i < CompilerWhiteBoxTest.OSR_WARMUP; ++i) { + result += (int)m.invoke(helper, 1); + } + // Make sure method is not (yet) compiled + WhiteBox.getWhiteBox().deoptimizeMethod(m, false); + return result; + } + + /** + * Executes the constructor multiple times to make sure we + * have enough profiling information before triggering an OSR + * compilation. Otherwise the C2 compiler may add uncommon traps. + * + * @param c Constructor to be executed + * @return Number of times the constructor was executed + * @throws Exception + */ + private static int warmup(Constructor c) throws Exception { + int result = 0; + for (long i = 0; i < CompilerWhiteBoxTest.OSR_WARMUP; ++i) { + result += c.newInstance(null, 1).hashCode(); + } + // Make sure method is not (yet) compiled + WhiteBox.getWhiteBox().deoptimizeMethod(c, false); + return result; + } + private static final Constructor CONSTRUCTOR; private static final Constructor OSR_CONSTRUCTOR; private static final Method METHOD; @@ -521,25 +567,24 @@ } try { OSR_CONSTRUCTOR = Helper.class.getDeclaredConstructor( - Object.class); + Object.class, long.class); } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException( - "exception on getting method Helper.(Object)", e); + "exception on getting method Helper.(Object, long)", e); } METHOD = getMethod("method"); STATIC = getMethod("staticMethod"); - OSR_METHOD = getMethod("osrMethod"); - OSR_STATIC = getMethod("osrStaticMethod"); + OSR_METHOD = getMethod("osrMethod", long.class); + OSR_STATIC = getMethod("osrStaticMethod", long.class); } - private static Method getMethod(String name) { + private static Method getMethod(String name, Class... parameterTypes) { try { - return Helper.class.getDeclaredMethod(name); + return Helper.class.getDeclaredMethod(name, parameterTypes); } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException( "exception on getting method Helper." + name, e); } - } private static int staticMethod() { @@ -550,17 +595,17 @@ return 42; } - private static int osrStaticMethod() { + private static int osrStaticMethod(long limit) { int result = 0; - for (long i = 0; i < CompilerWhiteBoxTest.BACKEDGE_THRESHOLD; ++i) { + for (long i = 0; i < limit; ++i) { result += staticMethod(); } return result; } - private int osrMethod() { + private int osrMethod(long limit) { int result = 0; - for (long i = 0; i < CompilerWhiteBoxTest.BACKEDGE_THRESHOLD; ++i) { + for (long i = 0; i < limit; ++i) { result += method(); } return result; @@ -574,9 +619,9 @@ } // for OSR constructor test case - private Helper(Object o) { + private Helper(Object o, long limit) { int result = 0; - for (long i = 0; i < CompilerWhiteBoxTest.BACKEDGE_THRESHOLD; ++i) { + for (long i = 0; i < limit; ++i) { result += method(); } x = result; --- old/test/compiler/whitebox/DeoptimizeMethodTest.java 2014-10-03 10:52:57.037644468 +0200 +++ new/test/compiler/whitebox/DeoptimizeMethodTest.java 2014-10-03 10:52:56.389644490 +0200 @@ -25,7 +25,6 @@ * @test DeoptimizeMethodTest * @bug 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build DeoptimizeMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission --- old/test/compiler/whitebox/DeoptimizeAllTest.java 2014-10-03 10:52:56.937644471 +0200 +++ new/test/compiler/whitebox/DeoptimizeAllTest.java 2014-10-03 10:52:56.441644488 +0200 @@ -25,7 +25,6 @@ * @test DeoptimizeAllTest * @bug 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build DeoptimizeAllTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission --- old/test/compiler/whitebox/GetNMethodTest.java 2014-10-03 10:52:57.061644467 +0200 +++ new/test/compiler/whitebox/GetNMethodTest.java 2014-10-03 10:52:56.441644488 +0200 @@ -28,7 +28,6 @@ * @test GetNMethodTest * @bug 8038240 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build GetNMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission --- old/test/compiler/whitebox/EnqueueMethodForCompilationTest.java 2014-10-03 10:52:57.009644469 +0200 +++ new/test/compiler/whitebox/EnqueueMethodForCompilationTest.java 2014-10-03 10:52:56.417644489 +0200 @@ -25,7 +25,6 @@ * @test EnqueueMethodForCompilationTest * @bug 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build EnqueueMethodForCompilationTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission --- old/test/compiler/tiered/TieredLevelsTest.java 2014-10-03 10:52:57.101644466 +0200 +++ new/test/compiler/tiered/TieredLevelsTest.java 2014-10-03 10:52:56.433644489 +0200 @@ -24,7 +24,6 @@ /** * @test TieredLevelsTest * @library /testlibrary /testlibrary/whitebox /compiler/whitebox - * @ignore 8046268 * @build TieredLevelsTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission --- old/test/compiler/whitebox/ClearMethodStateTest.java 2014-10-03 10:52:57.173644463 +0200 +++ new/test/compiler/whitebox/ClearMethodStateTest.java 2014-10-03 10:52:56.749644478 +0200 @@ -27,7 +27,6 @@ * @test ClearMethodStateTest * @bug 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build ClearMethodStateTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission --- old/test/compiler/tiered/NonTieredLevelsTest.java 2014-10-03 10:52:57.357644457 +0200 +++ new/test/compiler/tiered/NonTieredLevelsTest.java 2014-10-03 10:52:56.649644481 +0200 @@ -26,7 +26,6 @@ /** * @test NonTieredLevelsTest * @library /testlibrary /testlibrary/whitebox /compiler/whitebox - * @ignore 8046268 * @build NonTieredLevelsTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission --- old/test/compiler/whitebox/MakeMethodNotCompilableTest.java 2014-10-03 10:52:57.369644457 +0200 +++ new/test/compiler/whitebox/MakeMethodNotCompilableTest.java 2014-10-03 10:52:56.681644480 +0200 @@ -25,7 +25,6 @@ * @test MakeMethodNotCompilableTest * @bug 8012322 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build MakeMethodNotCompilableTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission