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

VerifyError instead of ClassFormatError for bad stack map offset

XMLWordPrintable

    • b31
    • generic
    • generic



      Name: viR10068 Date: 11/14/2003


      The JVM (1.5.0-beta-b28) throws the VerifyError when the
      byte_code_offset points to the middle of the instruction.
      But in the similar case for the pc-pointers (start_pc,
      end_pc) of the Code attribute (exception table) the JVM
      throws the ClassFormatError. The JVM behavior should
      be consistent.

      The new JCK test is failed due to this error:
      vm/cldc/classfmt/stackmap012/stackmap01203m1/stackmap01203m1.html

      The test source:
      --------------------- test16.jcod ---------------------------
      class test16 {
        0xCAFEBABE;
        0;
        49;
        [] { // Constant Pool
          ; // first element is empty
          Method #3 #5; // #1
          Utf8 "StackMap"; // #2
          class #4; // #3
          Utf8 "java/lang/Object"; // #4
          NameAndType #10 #7; // #5
          Utf8 "SourceFile"; // #6
          Utf8 "()V"; // #7
          Utf8 "Code"; // #8
          Utf8 "a.jasm"; // #9
          Utf8 "<init>"; // #10
          class #12; // #11
          Utf8 "test16"; // #12
        } // Constant Pool

        0x0000; // access
        #11;// this_cpx
        #3;// super_cpx

        [] { // Interfaces
        } // Interfaces

        [] { // fields
        } // fields

        [] { // methods
          { // Member
            0x0001; // access
            #10; // name_cpx
            #7; // sig_cpx
            [] { // Attributes
              Attr(#8) { // Code
                2; // max_stack
                1; // max_stack_items
                Bytes[]{
                  0x2AB70001B11000B1;
                };
                [] { // Traps
                } // end Traps
                [] { // Attributes
                  Attr(#2) { // StackMap
                      [] { //
                        5, []{}, []{I};
                        6, []{}, []{I};
                      }
                  } // end StackMap
                } // Attributes
              } // end Code
            } // Attributes
          } // Member
        } // methods

        [] { // Attributes
          Attr(#6) { // SourceFile
            #9;
          } // end SourceFile
        } // Attributes
      } // end class
      -------------------------------------------------------------
      The execution log:
      % dest/jdk1.5.0-b28/solaris-sparc/bin/java -showversion -Xfuture test16
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b28)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b28, mixed mode)

      Exception in thread "main" java.lang.VerifyError: Bad stack map offset in method
      test16.<init>()V at offset 6
      %

      ======================================================================

      Name: viR10068 Date: 11/16/2003


      The following new JCK test also are failed due to this error:
      vm/cldc/typechecker/rules/rules002/rules00201m2/rules00201m2.html
      vm/cldc/typechecker/rules/rules002/rules00201m3/rules00201m3.html
      vm/cldc/typechecker/rules/rules002/rules00201m5/rules00201m5.html
      vm/cldc/typechecker/rules/rules002/rules00201m6/rules00201m6.html


      ======================================================================

            myangsunw Mingyao Yang (Inactive)
            vivsunw Viv Viv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: