mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8138809: improve tests for CompilerToVM::hasCompiledCodeForOSR
Reviewed-by: kvn
This commit is contained in:
parent
7af927f9c1
commit
25bd94edfe
1 changed files with 18 additions and 8 deletions
|
@ -43,22 +43,18 @@ 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 {
|
||||
public static void main(String[] args) {
|
||||
List<CompileCodeTestCase>testCases = createTestCases();
|
||||
List<CompileCodeTestCase> testCases = createTestCases();
|
||||
testCases.forEach(HasCompiledCodeForOSRTest::runSanityTest);
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue