Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8016235

Wrong bytecode generation in try/catch block

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 8
    • core-libs
    • None
    • b96
    • generic
    • generic
    • Verified

    Description

      You will get the exception pasted at the end of this bug description using the following test case.

      function doit() {
      try {
          var parser = {};
        } catch (err) {
          parser = parser.context();
        }
      }


      xception in thread "main" java.lang.VerifyError: Bad local variable type
      Exception Details:
        Location:
          jdk/nashorn/internal/scripts/Script$ifthen.doit(Ljava/lang/Object;)Ljava/lang/Object; @39: aload_2
        Reason:
          Type top (current frame, locals[2]) is not assignable to reference type
        Current Frame:
          bci: @39
          flags: { }
          locals: { 'java/lang/Object', top, top, 'java/lang/Throwable', 'java/lang/Object' }
          stack: { }
        Bytecode:
          0000000: bb00 2b59 04b8 001e b700 2e59 b800 33b6
          0000010: 0039 4da7 0022 4e2d 59c1 003b 9900 09c0
          0000020: 003b b400 3f3a 042c 59ba 0049 0000 5fba
          0000030: 004d 0000 4db2 0056 b0
        Exception Handler Table:
          bci [0, 22] => handler: 22
        Stackmap Table:
          same_locals_1_stack_item_frame(@22,Object[#80])
          full_frame(@37,{Object[#91],Top,Top,Object[#80]},{Object[#91]})
          full_frame(@53,{Object[#91],Top,Object[#91]},{})

      at java.lang.Class.getDeclaredFields0(Native Method)
      at java.lang.Class.privateGetDeclaredFields(Class.java:2367)
      at java.lang.Class.getDeclaredField(Class.java:1902)
      at jdk.nashorn.internal.codegen.Compiler$2.run(Compiler.java:417)
      at jdk.nashorn.internal.codegen.Compiler$2.run(Compiler.java:413)
      at java.security.AccessController.doPrivileged(Native Method)
      at jdk.nashorn.internal.codegen.Compiler.install(Compiler.java:413)
      at jdk.nashorn.internal.codegen.Compiler.install(Compiler.java:447)
      at jdk.nashorn.internal.runtime.Context.compile(Context.java:800)
      at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:756)
      at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:343)
      at jdk.nashorn.tools.Shell.runScripts(Shell.java:308)
      at jdk.nashorn.tools.Shell.run(Shell.java:178)
      at jdk.nashorn.tools.Shell.main(Shell.java:142)
      at jdk.nashorn.tools.Shell.main(Shell.java:121)

      Attachments

        Activity

          People

            lagergren Marcus Lagergren
            jfdenise Jean-Francois Denise (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: