mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8139170: JVMCI refresh
Reviewed-by: kvn
This commit is contained in:
parent
a4e16dd190
commit
a38ea495d6
246 changed files with 4445 additions and 2901 deletions
|
@ -42,10 +42,12 @@
|
|||
package compiler.jvmci.compilerToVM;
|
||||
|
||||
import jdk.vm.ci.hotspot.CompilerToVMHelper;
|
||||
import jdk.vm.ci.code.InstalledCode;
|
||||
import jdk.test.lib.Asserts;
|
||||
import sun.hotspot.code.NMethod;
|
||||
|
||||
import java.util.List;
|
||||
import jdk.test.lib.Utils;
|
||||
|
||||
public class DisassembleCodeBlobTest {
|
||||
|
||||
|
@ -56,12 +58,23 @@ public class DisassembleCodeBlobTest {
|
|||
= CompileCodeTestCase.generate(/* bci = */ -1);
|
||||
testCases.addAll(CompileCodeTestCase.generate(/* bci = */ 0));
|
||||
testCases.forEach(test::check);
|
||||
testCases.stream().findAny().ifPresent(test::checkZero);
|
||||
test.checkNull();
|
||||
}
|
||||
|
||||
private void checkNull() {
|
||||
String str = CompilerToVMHelper.disassembleCodeBlob(0L);
|
||||
Asserts.assertNull(str, "not null string returned for null pointer");
|
||||
Utils.runAndCheckException(
|
||||
() -> CompilerToVMHelper.disassembleCodeBlob(null),
|
||||
NullPointerException.class);
|
||||
}
|
||||
|
||||
private void checkZero(CompileCodeTestCase testCase) {
|
||||
System.out.println("checkZero for " + testCase);
|
||||
testCase.deoptimize();
|
||||
InstalledCode installedCode = testCase.toInstalledCode();
|
||||
String str = CompilerToVMHelper.disassembleCodeBlob(installedCode);
|
||||
Asserts.assertNull(str, testCase
|
||||
+ " : non-null return value for invalid installCode");
|
||||
}
|
||||
|
||||
private void check(CompileCodeTestCase testCase) {
|
||||
|
@ -71,12 +84,13 @@ public class DisassembleCodeBlobTest {
|
|||
if (nMethod == null) {
|
||||
throw new Error(testCase + " : method is not compiled");
|
||||
}
|
||||
String str = CompilerToVMHelper.disassembleCodeBlob(nMethod.address);
|
||||
InstalledCode installedCode = testCase.toInstalledCode();
|
||||
String str = CompilerToVMHelper.disassembleCodeBlob(installedCode);
|
||||
if (str != null) {
|
||||
Asserts.assertGT(str.length(), 0,
|
||||
testCase + " : returned string has to be non-zero length");
|
||||
}
|
||||
String str2 = CompilerToVMHelper.disassembleCodeBlob(nMethod.address);
|
||||
String str2 = CompilerToVMHelper.disassembleCodeBlob(installedCode);
|
||||
Asserts.assertEQ(str, str2,
|
||||
testCase + " : 2nd invocation returned different value");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue