8154073: Several compiler tests fail when are executed with C1 only

Added missing flag checks to the tests and Whitebox API.

Reviewed-by: kvn
This commit is contained in:
Tobias Hartmann 2016-04-14 08:32:39 +02:00
parent e33bf84754
commit 63403a410e
4 changed files with 16 additions and 11 deletions

View File

@ -1060,6 +1060,7 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 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->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(!method->method_holder()->is_not_initialized(), "method holder must be initialized");
assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level");
// allow any levels for WhiteBox // allow any levels for WhiteBox
assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered");
// return quickly if possible // return quickly if possible

View File

@ -641,7 +641,8 @@ WB_END
bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* THREAD) { bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* THREAD) {
// Screen for unavailable/bad comp level or null method // 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; return false;
} }
methodHandle mh(THREAD, method); methodHandle mh(THREAD, method);

View File

@ -72,6 +72,7 @@ public class TestArrayCopyNoInitDeopt {
} }
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); 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 { static boolean deoptimize(Method method, Object src_obj) throws Exception {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@ -84,7 +85,9 @@ public class TestArrayCopyNoInitDeopt {
} }
static public void main(String[] args) throws Exception { 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]; int[] src = new int[10];
Object src_obj = new Object(); Object src_obj = new Object();
Method method_m1 = TestArrayCopyNoInitDeopt.class.getMethod("m1", Object.class); Method method_m1 = TestArrayCopyNoInitDeopt.class.getMethod("m1", Object.class);

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -44,8 +44,10 @@ import sun.misc.Unsafe;
import compiler.whitebox.CompilerWhiteBoxTest; import compiler.whitebox.CompilerWhiteBoxTest;
public class TestExplicitRangeChecks { public class TestExplicitRangeChecks {
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
static int[] array = new int[10]; 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) @Retention(RetentionPolicy.RUNTIME)
@interface Args { @interface Args {
@ -366,10 +368,6 @@ public class TestExplicitRangeChecks {
return true; return true;
} }
static boolean success = true;
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
final HashMap<String,Method> tests = new HashMap<>(); final HashMap<String,Method> tests = new HashMap<>();
{ {
for (Method m : this.getClass().getDeclaredMethods()) { for (Method m : this.getClass().getDeclaredMethods()) {
@ -439,7 +437,9 @@ public class TestExplicitRangeChecks {
System.out.println(name + " bad result for bad input " + bad[i]); System.out.println(name + " bad result for bad input " + bad[i]);
success = false; 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)) { if (deoptimize && WHITE_BOX.isMethodCompiled(m)) {
System.out.println(name + " not deoptimized on invalid access"); System.out.println(name + " not deoptimized on invalid access");
success = false; success = false;