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

GetLocalObject() on "not DA" local variable fails assert(type() == T_OBJECT) failed: type check

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: hs21
    • Fix Version/s: None
    • Component/s: hotspot
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Interesting debugging issue based on discussions with Jim H.

      Here is the test program:

       1 public class NotDALocalVarTest
       2 {
       3 public static void main(String[] args) {
       4 int ii;
       5 Object isNotDA;
       6 Object isDA = "isDA1";
       7 Object isDANull = null;
       8 try {
       9 ii = 22;
      10 isNotDA = "isNotDAv";
      11 isDA = "isDAv";
      12 isDANull = "isDANullv";
      13 throw new RuntimeException(); // here, jdb correctly says
      14 // isNotDA has value "isNotDAv"
      15 } catch (RuntimeException e)
      16 {
      17 // here, jdb says ii has value 22 as expected,
      18 // isDA has value "isDAv" as expected,
      19 // isDANull has value "isDANullv" as expected,
      20 // but isNotDA has value null instead of "isNotDAv"
      21 System.out.println("catch");
      22 }
      23 System.out.println("done");
      24 }
      25 }


      Here is a trimmed down "javap -c -l -v" dump of the program:

      Classfile /C:/cygwin/home/dcubed/Projects/da-local-vars/NotDALocalVarTest.class
        Last modified Apr 22, 2011; size 924 bytes
        MD5 checksum f9c2dc654e16742a18216f1e324ac0f2
        Compiled from "NotDALocalVarTest.java"
      public class NotDALocalVarTest
        SourceFile: "NotDALocalVarTest.java"
        minor version: 0
        major version: 51
        flags: ACC_PUBLIC, ACC_SUPER
      Constant pool:
         #1 = Methodref #13.#39 // java/lang/Object."<init>":()V
         #2 = String #40 // isDA1
         #3 = String #41 // isNotDAv
         #4 = String #42 // isDAv
         #5 = String #43 // isDANullv
         #6 = Class #44 // java/lang/RuntimeException
         #7 = Methodref #6.#39 // java/lang/RuntimeException."<init>":()V
         #8 = Fieldref #45.#46 // java/lang/System.out:Ljava/io/PrintStream;
         #9 = String #47 // catch
        #10 = Methodref #48.#49 // java/io/PrintStream.println:(Ljava/lang/String;)V
        #11 = String #50 // done
      <snip>
      {
        public NotDALocalVarTest();
          flags: ACC_PUBLIC
          LineNumberTable:
            line 1: 0
          LocalVariableTable:
            Start Length Slot Name Signature
                   0 5 0 this LNotDALocalVarTest;
          Code:
            stack=1, locals=1, args_size=1
               0: aload_0
               1: invokespecial #1 // Method java/lang/Object."<init>":()V
               4: return
            LineNumberTable:
              line 1: 0
            LocalVariableTable:
              Start Length Slot Name Signature
                     0 5 0 this LNotDALocalVarTest;

        public static void main(java.lang.String[]);
          flags: ACC_PUBLIC, ACC_STATIC
          LineNumberTable:
            line 6: 0
            line 7: 3
            line 9: 6
            line 10: 9
            line 11: 12
            line 12: 15
            line 13: 19
            line 15: 27
            line 21: 29
            line 23: 37
            line 24: 45
          LocalVariableTable:
            Start Length Slot Name Signature
                  29 8 5 e Ljava/lang/RuntimeException;
                   0 46 0 args [Ljava/lang/String;
                   9 37 1 ii I
                  12 34 2 isNotDA Ljava/lang/Object;
                   3 43 3 isDA Ljava/lang/Object;
                   6 40 4 isDANull Ljava/lang/Object;
          Code:
            stack=2, locals=6, args_size=1
               0: ldc #2 // String isDA1
               2: astore_3
               3: aconst_null
               4: astore 4
               6: bipush 22
               8: istore_1
               9: ldc #3 // String isNotDAv
              11: astore_2
              12: ldc #4 // String isDAv
              14: astore_3
              15: ldc #5 // String isDANullv
              17: astore 4
              19: new #6 // class java/lang/RuntimeException
              22: dup
              23: invokespecial #7 // Method java/lang/RuntimeException."<init>":()V
              26: athrow
              27: astore 5
              29: getstatic #8 // Field java/lang/System.out:Ljava/io/PrintStream;
              32: ldc #9 // String catch
              34: invokevirtual #10 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
              37: getstatic #8 // Field java/lang/System.out:Ljava/io/PrintStream;
              40: ldc #11 // String done
              42: invokevirtual #10 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
              45: return
            Exception table:
               from to target type
                   6 27 27 Class java/lang/RuntimeException
            LineNumberTable:
              line 6: 0
              line 7: 3
              line 9: 6
              line 10: 9
              line 11: 12
              line 12: 15
              line 13: 19
              line 15: 27
              line 21: 29
              line 23: 37
              line 24: 45
            LocalVariableTable:
              Start Length Slot Name Signature
                    29 8 5 e Ljava/lang/RuntimeException;
                     0 46 0 args [Ljava/lang/String;
                     9 37 1 ii I
                    12 34 2 isNotDA Ljava/lang/Object;
                     3 43 3 isDA Ljava/lang/Object;
                     6 40 4 isDANull Ljava/lang/Object;
            StackMapTable: number_of_entries = 1
                 frame_type = 255 /* full_frame */
                offset_delta = 27
                locals = [ class "[Ljava/lang/String;", top, top, class java/lang/Object, class java/lang/Object ]
                stack = [ class java/lang/RuntimeException ]

      }



      When local variable "isNotDA" is printed at a breakpoint on
      line 21, the fastdebug VM will fail an assertion.


      Here's a jdb run with Client VM fastdebug bits:

      ksh do_jdb.ksh 2>&1 | tee do_jdb.client-fast.log
      + sleep 5
      Initializing jdb ...
      > + echo stop at NotDALocalVarTest:9
      Deferring breakpoint NotDALocalVarTest:9.
      It will be set after the class is loaded.
      > + echo stop at NotDALocalVarTest:13
      Deferring breakpoint NotDALocalVarTest:13.
      It will be set after the class is loaded.
      > + echo stop at NotDALocalVarTest:21
      Deferring breakpoint NotDALocalVarTest:21.
      It will be set after the class is loaded.
      > + echo stop at NotDALocalVarTest:23
      + echo run -client-fast -showversion NotDALocalVarTest
      + sleep 3
      Deferring breakpoint NotDALocalVarTest:23.
      It will be set after the class is loaded.
      > run -client-fast -showversion NotDALocalVarTest
      Set uncaught java.lang.Throwable
      Set deferred uncaught java.lang.Throwable
      >
      VM Started: java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b139)
      Java HotSpot(TM) Client VM (build 21.0-b09-fastdebug, mixed mode)

      Set deferred breakpoint NotDALocalVarTest:23
      Set deferred breakpoint NotDALocalVarTest:21
      Set deferred breakpoint NotDALocalVarTest:13
      Set deferred breakpoint NotDALocalVarTest:9

      Breakpoint hit: "thread=main", NotDALocalVarTest.main(), line=9 bci=6
      9 ii = 22;

      main[1] + echo locals
      + echo cont
      + sleep 1
      Method arguments:
      args = instance of java.lang.String[0] (id=376)
      Local variables:
      isDA = "isDA1"
      isDANull = null
      main[1] >
      Breakpoint hit: "thread=main", NotDALocalVarTest.main(), line=13 bci=19
      13 throw new RuntimeException(); // here, jdb correctly says

      main[1] + echo locals
      + echo cont
      + sleep 1
      Method arguments:
      args = instance of java.lang.String[0] (id=376)
      Local variables:
      isDA = "isDAv"
      isDANull = "isDANullv"
      ii = 22
      isNotDA = "isNotDAv"
      main[1] >
      Breakpoint hit: "thread=main", NotDALocalVarTest.main(), line=21 bci=29
      21 System.out.println("catch");

      main[1] + echo locals
      + echo cont
      + sleep 1
      # To suppress the following error report, specify this argument
      # after -XX: or in .hotspotrc: SuppressErrorAt=\runtime/stackValue.hpp:64
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (c:\jdk7_32p\jdk7\hotspot\src\share\vm\runtime/stackValue.hpp:64), pid=6892, tid=6448
      # assert(type() == T_OBJECT) failed: type check
      #
      # JRE version: 7.0-b139
      # Java VM: Java HotSpot(TM) Client VM (21.0-b09-fastdebug mixed mode windows-x86 )
      # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
      #
      # An error report file with more information is saved as:
      # C:\cygwin\home\dcubed\Projects\da-local-vars\hs_err_pid6892.log
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.sun.com/bugreport/crash.jsp
      #
      Phoning home...
      Using server: 10.161.186.18, port 4711
      Internal exception:

      The application has been disconnected
      + echo locals

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            dcubed Daniel Daugherty
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: