--- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java Tue Nov 03 09:41:03 2015 +0100
+++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java Tue Nov 03 20:12:47 2015 +0300
@@ -43,22 +43,18 @@
import compiler.jvmci.common.CTVMUtilities;
import java.lang.reflect.Executable;
-import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import compiler.testlibrary.CompilerUtils;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
-import sun.hotspot.WhiteBox;
import sun.hotspot.code.NMethod;
public class HasCompiledCodeForOSRTest {
public static void main(String[] args) {
- List<CompileCodeTestCase>testCases = createTestCases();
+ List<CompileCodeTestCase> testCases = createTestCases();
testCases.forEach(HasCompiledCodeForOSRTest::runSanityTest);
}
@@ -98,7 +94,9 @@
boolean isCompiled;
int level = nm.comp_level;
- for (int i : levels) {
+ int[] someLevels = new int[] {-4, 0, 1, 2, 3, 4, 5, 45};
+ // check levels
+ for (int i : someLevels) {
isCompiled = CompilerToVMHelper.hasCompiledCodeForOSR(
method, testCase.bci, i);
Asserts.assertEQ(isCompiled, level == i, String.format(
@@ -106,8 +104,20 @@
+ "level %d", testCase, i));
}
- for (int i : new int[] {-1, +1}) {
- int bci = testCase.bci + i;
+ // check bci
+ byte[] bytecode = CompilerToVMHelper.getBytecode(CTVMUtilities
+ .getResolvedMethod(testCase.executable));
+ int[] incorrectBci = new int[] {
+ testCase.bci + 1,
+ testCase.bci - 1,
+ -200,
+ -10,
+ bytecode.length,
+ bytecode.length + 1,
+ bytecode.length + 4,
+ bytecode.length + 200
+ };
+ for (int bci : incorrectBci) {
isCompiled = CompilerToVMHelper.hasCompiledCodeForOSR(
method, bci, level);
Asserts.assertFalse(isCompiled, String.format(