harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elena Sayapina (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4053) [drlvm][verifier] Unexpected VerifyError is thrown if end_pc from exception table of code attribute is equal to the length of the code array
Date Wed, 06 Jun 2007 05:58:26 GMT
[drlvm][verifier] Unexpected VerifyError is thrown if end_pc from exception table of code attribute
is equal to the length of the code array
--------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-4053
                 URL: https://issues.apache.org/jira/browse/HARMONY-4053
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
            Reporter: Elena Sayapina
         Attachments: reproduce.zip

Unexpected VerifyError is thrown if end_pc from exception table of code attribute is equal
to the length of the code array

This issue caused the failures of 11 test cases from Geronimo unit test suite.

Affected tests:
org.apache.geronimo.gjndi.JavaCompContextTest
org.apache.geronimo.gjndi.JavaCompGBeanTest
org.apache.geronimo.gjndi.KernelContextGBeanTest

According J2SE VM specification:

"4.7.3 The Code Attribute
...
Each exception_table entry contains the following four items: 
start_pc, end_pc 
The values of the two items start_pc and end_pc indicate the ranges in the code array at which
the exception handler is active. The value of start_pc must be a valid index into the code
array of the opcode of an instruction. The value of end_pc either must be a valid index into
the code array of the opcode of an instruction or must be equal to code_length, the length
of the code array ... "

But DRLVM throws VerifyError if ending point in exception table is equal to the length of
the code array.

Please, use the code below for reproducing: 

------------------------------------- Verify.java --------------------------------------

public class Verify {

            public static void main(String[] args) throws ClassNotFoundException {
                        try {
                                   Class cl = Class.forName("test");
                                   System.out.println("TEST PASSED");
                        } catch (Throwable e) {
                                   System.out.println("TEST FAILED: unexpected " + e);
                        }
            }
}

------------------------------------- test.ccode--------------------------------------

magic = xCAFEBABE
minor_version = 3
major_version = 45
constant_pool_count = 13

constant_pool {
  /* #1 */ Method = #12 #6
  /* #2 */ UTF8 = "java/lang/Object"
  /* #3 */ UTF8 = "SourceFile"
  /* #4 */ UTF8 = "<init>"
  /* #5 */ Class = #11
  /* #6 */ NameAndType = #4 #10
  /* #7 */ UTF8 = "Code"
  /* #8 */ UTF8 = "test.ccode"
  /* #9 */ UTF8 = "test"
  /* #10 */ UTF8 = "()V"
  /* #11 */ UTF8 = "test"
  /* #12 */ Class = #2
}

access_flags = PUBLIC SUPER  // x21
this_class = #5  // "test"
super_class = #12  // "java/lang/Object"
interfaces_count = 0

interfaces {
}

fields_count = 0
methods_count = 2

methods {
  method {
    access_flag = PUBLIC  // x01
    name_index = #4  // "<init>"
    descriptor_index = #10  // "()V"
    attributes_count = 1

      attributes {
        attribute Code {
          attribute_name_index = #7  // "Code"
          attribute_length = 17
          max_stack = 1
          max_locals = 1
          code_length = 5

          code asm {
          0:           aload_0
          1:           invokespecial #1
          4:           return
          }

          exception_table_length = 0
          attributes_count = 0
        }
      }
  }

// Test method

  method {
    access_flag = PUBLIC  // x01
    name_index = #9  // "test"
    descriptor_index = #10  // "()V"
    attributes_count = 1
      attributes {
        attribute Code {
          attribute_name_index = #7  // "Code"
          attribute_length = 35
          max_stack = 2
          max_locals = 2
          code_length = 15

          code asm {
          0:           sipush 1
          3:           pop
          4:           return
          5:           sipush 2
          8:           pop
          9:           return
          10:         sipush 3
          13:         pop
          14:         return
          }

          exception_table_length = 1
          exception_table {
            // start_pc end_pc handler_pc catch_type 
            0 15 10 0   // end_pc is equal to code_length
          }
          attributes_count = 0
        }
      }
  }
}

attributes_count = 1

attributes {

  attribute SourceFile {
    attribute_name_index = #3  // "SourceFile"
    attribute_length = 2
    sourcefile_index = #8  // "test.ccode"
  }
}

-----------------------------------------------------------------------------------------------

test class file can be created using VMTT tool from http://issues.apache.org/jira/browse/HARMONY-3206

reproduce.zip contains test and Verify class files.

Output on Harmony-r544727:

Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r544727, (Jun  6 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org

TEST FAILED: unexpected java.lang.VerifyError: (class: test, method: test()V) At least one
of except
ion handler parameters [0, 15, 10] are out of instruction set


Output on RI:

java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

TEST PASSED



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message