8138809: improve tests for CompilerToVM::hasCompiledCodeForOSR

Reviewed-by: kvn
This commit is contained in:
Tatiana Pivovarova 2015-11-03 20:12:47 +03:00
parent 7af927f9c1
commit 25bd94edfe

View file

@ -43,17 +43,13 @@ package compiler.jvmci.compilerToVM;
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 {
@ -98,7 +94,9 @@ public class HasCompiledCodeForOSRTest {
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 @@ public class HasCompiledCodeForOSRTest {
+ "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(