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:
parent
e33bf84754
commit
63403a410e
@ -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(!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
|
||||
|
@ -641,7 +641,8 @@ WB_END
|
||||
|
||||
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);
|
||||
|
@ -72,6 +72,7 @@ public class TestArrayCopyNoInitDeopt {
|
||||
}
|
||||
|
||||
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 @@ public class TestArrayCopyNoInitDeopt {
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -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 sun.misc.Unsafe;
|
||||
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 @@ public class TestExplicitRangeChecks {
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean success = true;
|
||||
|
||||
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
|
||||
|
||||
final HashMap<String,Method> tests = new HashMap<>();
|
||||
{
|
||||
for (Method m : this.getClass().getDeclaredMethods()) {
|
||||
@ -439,7 +437,9 @@ public class TestExplicitRangeChecks {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user