test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File hotspot Sdiff test/compiler/jvmci/compilerToVM

test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java

Print this page




  44  *                   compiler.jvmci.compilerToVM.DisassembleCodeBlobTest
  45  */
  46 
  47 package compiler.jvmci.compilerToVM;
  48 
  49 import jdk.test.lib.Asserts;
  50 import jdk.test.lib.Utils;
  51 import jdk.vm.ci.code.InstalledCode;
  52 import jdk.vm.ci.hotspot.CompilerToVMHelper;
  53 import sun.hotspot.code.NMethod;
  54 
  55 import java.util.List;
  56 
  57 public class DisassembleCodeBlobTest {
  58 
  59     public static void main(String[] args) {
  60         DisassembleCodeBlobTest test
  61                 = new DisassembleCodeBlobTest();
  62         List<CompileCodeTestCase> testCases
  63                 = CompileCodeTestCase.generate(/* bci = */ -1);
  64         testCases.addAll(CompileCodeTestCase.generate(/* bci = */ 0));
  65         testCases.forEach(test::check);
  66         testCases.stream().findAny().ifPresent(test::checkZero);
  67         test.checkNull();
  68     }
  69 
  70     private void checkNull() {
  71         Utils.runAndCheckException(
  72                 () -> CompilerToVMHelper.disassembleCodeBlob(null),
  73                 NullPointerException.class);
  74     }
  75 
  76     private void checkZero(CompileCodeTestCase testCase) {
  77         System.out.println("checkZero for " + testCase);
  78         testCase.deoptimize();
  79         InstalledCode installedCode = testCase.toInstalledCode();
  80         String str = CompilerToVMHelper.disassembleCodeBlob(installedCode);
  81         Asserts.assertNull(str, testCase
  82                 + " : non-null return value for invalid installCode");
  83     }
  84 


  44  *                   compiler.jvmci.compilerToVM.DisassembleCodeBlobTest
  45  */
  46 
  47 package compiler.jvmci.compilerToVM;
  48 
  49 import jdk.test.lib.Asserts;
  50 import jdk.test.lib.Utils;
  51 import jdk.vm.ci.code.InstalledCode;
  52 import jdk.vm.ci.hotspot.CompilerToVMHelper;
  53 import sun.hotspot.code.NMethod;
  54 
  55 import java.util.List;
  56 
  57 public class DisassembleCodeBlobTest {
  58 
  59     public static void main(String[] args) {
  60         DisassembleCodeBlobTest test
  61                 = new DisassembleCodeBlobTest();
  62         List<CompileCodeTestCase> testCases
  63                 = CompileCodeTestCase.generate(/* bci = */ -1);

  64         testCases.forEach(test::check);
  65         testCases.stream().findAny().ifPresent(test::checkZero);
  66         test.checkNull();
  67     }
  68 
  69     private void checkNull() {
  70         Utils.runAndCheckException(
  71                 () -> CompilerToVMHelper.disassembleCodeBlob(null),
  72                 NullPointerException.class);
  73     }
  74 
  75     private void checkZero(CompileCodeTestCase testCase) {
  76         System.out.println("checkZero for " + testCase);
  77         testCase.deoptimize();
  78         InstalledCode installedCode = testCase.toInstalledCode();
  79         String str = CompilerToVMHelper.disassembleCodeBlob(installedCode);
  80         Asserts.assertNull(str, testCase
  81                 + " : non-null return value for invalid installCode");
  82     }
  83 
test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File