< prev index next >
test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java
Print this page
*** 32,41 ****
--- 32,42 ----
* sun.hotspot.WhiteBox$WhiteBoxPermission
* jdk.vm.ci.hotspot.CompilerToVMHelper
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -XX:-BackgroundCompilation
+ -XX:+LogCompilation
* compiler.jvmci.compilerToVM.AllocateCompileIdTest
*/
package compiler.jvmci.compilerToVM;
*** 49,59 ****
import java.util.Map;
import java.util.HashSet;
import compiler.jvmci.common.testcases.TestCase;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
! import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
import jdk.test.lib.Asserts;
import jdk.test.lib.Pair;
import jdk.test.lib.Utils;
import sun.hotspot.WhiteBox;
import sun.hotspot.code.NMethod;
--- 50,60 ----
import java.util.Map;
import java.util.HashSet;
import compiler.jvmci.common.testcases.TestCase;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
! import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.test.lib.Asserts;
import jdk.test.lib.Pair;
import jdk.test.lib.Utils;
import sun.hotspot.WhiteBox;
import sun.hotspot.code.NMethod;
*** 72,83 ****
private static List<CompileCodeTestCase> createTestCasesCorrectBci() {
List<CompileCodeTestCase> result = new ArrayList<>();
try {
Class<?> aClass = DummyClass.class;
Method method = aClass.getMethod("withLoop");
! result.add(new CompileCodeTestCase(method, 17));
! result.add(new CompileCodeTestCase(method, -1));
} catch (NoSuchMethodException e) {
throw new Error("TEST BUG : " + e, e);
}
return result;
}
--- 73,85 ----
private static List<CompileCodeTestCase> createTestCasesCorrectBci() {
List<CompileCodeTestCase> result = new ArrayList<>();
try {
Class<?> aClass = DummyClass.class;
Method method = aClass.getMethod("withLoop");
! Object receiver = new DummyClass();
! result.add(new CompileCodeTestCase(receiver, method, 17));
! result.add(new CompileCodeTestCase(receiver, method, -1));
} catch (NoSuchMethodException e) {
throw new Error("TEST BUG : " + e, e);
}
return result;
}
*** 88,107 ****
List<Pair<CompileCodeTestCase, Class<? extends Throwable>>> result
= new ArrayList<>();
try {
Class<?> aClass = DummyClass.class;
Method method = aClass.getMethod("dummyInstanceFunction");
// greater than bytecode.length
int[] bcis = new int[] {30, 50, 200};
for (int bci : bcis) {
! result.add(new Pair<>(new CompileCodeTestCase(method, bci),
IllegalArgumentException.class));
}
bcis = new int[] {-4, -50, -200};
for (int bci : bcis) {
! result.add(new Pair<>(new CompileCodeTestCase(method, bci),
IllegalArgumentException.class));
}
} catch (NoSuchMethodException e) {
throw new Error("TEST BUG : " + e.getMessage(), e);
}
--- 90,112 ----
List<Pair<CompileCodeTestCase, Class<? extends Throwable>>> result
= new ArrayList<>();
try {
Class<?> aClass = DummyClass.class;
+ Object receiver = new DummyClass();
Method method = aClass.getMethod("dummyInstanceFunction");
// greater than bytecode.length
int[] bcis = new int[] {30, 50, 200};
for (int bci : bcis) {
! result.add(new Pair<>(
! new CompileCodeTestCase(receiver, method, bci),
IllegalArgumentException.class));
}
bcis = new int[] {-4, -50, -200};
for (int bci : bcis) {
! result.add(new Pair<>(
! new CompileCodeTestCase(receiver, method, bci),
IllegalArgumentException.class));
}
} catch (NoSuchMethodException e) {
throw new Error("TEST BUG : " + e.getMessage(), e);
}
*** 109,120 ****
}
private void runSanityCorrectTest(CompileCodeTestCase testCase) {
System.out.println(testCase);
Executable aMethod = testCase.executable;
int bci = testCase.bci;
! HotSpotResolvedJavaMethodImpl method = CTVMUtilities
.getResolvedMethod(aMethod);
int wbCompileID = getWBCompileID(testCase);
int id = CompilerToVMHelper.allocateCompileId(method, bci);
Asserts.assertNE(id, 0, testCase + " : zero compile id");
--- 114,127 ----
}
private void runSanityCorrectTest(CompileCodeTestCase testCase) {
System.out.println(testCase);
Executable aMethod = testCase.executable;
+ // to generate ciTypeFlow
+ System.out.println(testCase.invoke(Utils.getNullValues(aMethod.getParameterTypes())));
int bci = testCase.bci;
! HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
int wbCompileID = getWBCompileID(testCase);
int id = CompilerToVMHelper.allocateCompileId(method, bci);
Asserts.assertNE(id, 0, testCase + " : zero compile id");
*** 138,148 ****
Pair<CompileCodeTestCase, Class<? extends Throwable>> testCase) {
System.out.println(testCase);
Class<? extends Throwable> exception = testCase.second;
Executable aMethod = testCase.first.executable;
int bci = testCase.first.bci;
! HotSpotResolvedJavaMethodImpl method = CTVMUtilities
.getResolvedMethod(aMethod);
Utils.runAndCheckException(
() -> CompilerToVMHelper.allocateCompileId(method, bci),
exception);
}
--- 145,155 ----
Pair<CompileCodeTestCase, Class<? extends Throwable>> testCase) {
System.out.println(testCase);
Class<? extends Throwable> exception = testCase.second;
Executable aMethod = testCase.first.executable;
int bci = testCase.first.bci;
! HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
Utils.runAndCheckException(
() -> CompilerToVMHelper.allocateCompileId(method, bci),
exception);
}
< prev index next >