--- old/src/share/vm/compiler/compileBroker.cpp 2016-04-13 14:46:14.961012664 +0200 +++ new/src/share/vm/compiler/compileBroker.cpp 2016-04-13 14:46:14.889012668 +0200 @@ -1060,6 +1060,7 @@ assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); + assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level"); // allow any levels for WhiteBox assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); // return quickly if possible --- old/src/share/vm/prims/whitebox.cpp 2016-04-13 14:46:15.237012651 +0200 +++ new/src/share/vm/prims/whitebox.cpp 2016-04-13 14:46:15.165012655 +0200 @@ -641,7 +641,8 @@ bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* THREAD) { // Screen for unavailable/bad comp level or null method - if (method == NULL || CompileBroker::compiler(comp_level) == NULL) { + if (method == NULL || comp_level > TieredStopAtLevel || + CompileBroker::compiler(comp_level) == NULL) { return false; } methodHandle mh(THREAD, method); --- old/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java 2016-04-13 14:46:15.485012640 +0200 +++ new/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java 2016-04-13 14:46:15.413012643 +0200 @@ -72,6 +72,7 @@ } private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + private static final int TIERED_STOP_AT_LEVEL = WHITE_BOX.getIntxVMFlag("TieredStopAtLevel").intValue(); static boolean deoptimize(Method method, Object src_obj) throws Exception { for (int i = 0; i < 10; i++) { @@ -84,7 +85,9 @@ } static public void main(String[] args) throws Exception { - if (Platform.isServer()) { + // Only execute if C2 is available + if (Platform.isServer() && + TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) { int[] src = new int[10]; Object src_obj = new Object(); Method method_m1 = TestArrayCopyNoInitDeopt.class.getMethod("m1", Object.class); --- old/test/compiler/rangechecks/TestExplicitRangeChecks.java 2016-04-13 14:46:15.725012629 +0200 +++ new/test/compiler/rangechecks/TestExplicitRangeChecks.java 2016-04-13 14:46:15.657012632 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @bug 8073480 * @summary explicit range checks should be recognized by C2 * @library /testlibrary /test/lib /compiler/whitebox / - * @build TestExplicitRangeChecks + * @build TestExplicitRangeChecks * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller jdk.test.lib.Platform * @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI @@ -44,8 +44,10 @@ import compiler.whitebox.CompilerWhiteBoxTest; public class TestExplicitRangeChecks { - - static int[] array = new int[10]; + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + private static final int TIERED_STOP_AT_LEVEL = WHITE_BOX.getIntxVMFlag("TieredStopAtLevel").intValue(); + private static int[] array = new int[10]; + private static boolean success = true; @Retention(RetentionPolicy.RUNTIME) @interface Args { @@ -366,10 +368,6 @@ return true; } - static boolean success = true; - - private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); - final HashMap tests = new HashMap<>(); { for (Method m : this.getClass().getDeclaredMethods()) { @@ -439,7 +437,9 @@ System.out.println(name + " bad result for bad input " + bad[i]); success = false; } - if (Platform.isServer()) { + // Only perform these additional checks if C2 is available + if (Platform.isServer() && + TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) { if (deoptimize && WHITE_BOX.isMethodCompiled(m)) { System.out.println(name + " not deoptimized on invalid access"); success = false;