--- old/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java 2015-11-02 17:07:05.000000000 -1000 +++ new/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java 2015-11-02 17:07:05.000000000 -1000 @@ -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 @@ = 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 @@ 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"); }