patch for PR java/1208, plus other try-finally cleanups

Tom Tromey
Wed Mar 21 12:51:00 GMT 2001

>>>>> "Per" == Per Bothner <> writes:

Per> There has been some discussion on the java list over PR 1208 and
Per> related issues with generating bytecode for TRY_FINALLY_EXPR;
Per> this is my candidate fix.  I'll give people a chance to critique
Per> it before I check it in.  Otherwise, I'll probably check it in
Per> tomorrow.

I like this patch since it nicely cleans up the try/finally code in

However this patch seems to introduce a new failure.
I've appended the fail info from my regression test.
I've also appended the `jcf-dump -c' output.

This is a test from the libjava test suite.

Alex has suggested having a function that would reduce empty blocks in
all situations.  Eg. {;} and { {;} {;} } would both become empty_stmt_node.
I don't think this is worth doing for 3.0 (or maybe even doing at
all).  If I remove the `;'s from the blocks in this test I get this

  0: iconst_0
  1: ireturn


Executing on host: /x1/gcc3/build/gcc/jv-scan /x1/gcc3/gcc/libjava/testsuite/libjava.compile/  --print-main     (timeout = 300)
spawn /x1/gcc3/build/gcc/jv-scan /x1/gcc3/gcc/libjava/testsuite/libjava.compile/ --print-main 
Executing on host: /x1/gcc3/build/gcc/jv-scan /x1/gcc3/gcc/libjava/testsuite/libjava.compile/  --list-class     (timeout = 300)
spawn /x1/gcc3/build/gcc/jv-scan /x1/gcc3/gcc/libjava/testsuite/libjava.compile/ --list-class 
G19990210_1 output is:
Executing on host: /x1/gcc3/build/i686-pc-linux-gnu/libjava/testsuite/../libtool --silent --tag=GCJ --mode=compile /x1/gcc3/build/gcc/gcj -B/x1/gcc3/build/gcc/ -B/x1/gcc3/build/i686-pc-linux-gnu/libjava/testsuite/../   -c -g  -o G19990210_1.o /x1/gcc3/build/i686-pc-linux-gnu/libjava/testsuite/G19990210_1.class    (timeout = 300)
spawn /x1/gcc3/build/i686-pc-linux-gnu/libjava/testsuite/../libtool --silent --tag=GCJ --mode=compile /x1/gcc3/build/gcc/gcj -B/x1/gcc3/build/gcc/ -B/x1/gcc3/build/i686-pc-linux-gnu/libjava/testsuite/../ -c -g -o G19990210_1.o /x1/gcc3/build/i686-pc-linux-gnu/libjava/testsuite/G19990210_1.class In class `G19990210_1': In method `': verification error at PC=10 loading local variable 2 which has unknown type
compiler exited with status 1
output is: In class `G19990210_1': In method `': verification error at PC=10 loading local variable 2 which has unknown type

Reading .class from ./G19990210_1.class.
Magic number: 0xcafebabe, minor_version: 3, major_version: 45.

Constant pool (count: 15):
#1: Utf8: "G19990210_1"
#2: Class name: 1="G19990210_1"
#3: Utf8: "java/lang/Object"
#4: Class name: 3="java/lang/Object"
#5: Utf8: "foo"
#6: Utf8: "()I"
#7: Utf8: "Code"
#8: Utf8: "LineNumberTable"
#9: Utf8: "<init>"
#10: Utf8: "()V"
#11: NameAndType name: 9=<init>, signature: 10=()void
#12: Methodref class: 4=java.lang.Object name_and_type: 11=<<init> ()void>
#13: Utf8: "SourceFile"
#14: Utf8: ""

Access flags: 0x21 public super
This class: 2=G19990210_1, super: 4=java.lang.Object
Interfaces (count: 0):

Fields (count: 0):

Methods (count: 2):

Method name:"foo" Signature: 6=()int
Attribute "Code", length:51, max_stack:1, max_locals:3, code_length:19
  0: jsr 12
  3: goto 15
  6: astore_2
  7: jsr 12
 10: aload_2
 11: athrow
 12: astore_1
 13: ret 1
 15: iconst_0
 16: istore_1
 17: iload_1
 18: ireturn
Exceptions (count: 1):
  start: 0, end: 6, handler: 6, type: 0 /* finally */
Attribute "LineNumberTable", length:6, count: 1
  line: 16 at pc: 15

Method name:"<init>" public Signature: 10=()void
Attribute "Code", length:17, max_stack:1, max_locals:1, code_length:5
  0: aload_0
  1: invokespecial #12=<Method java.lang.Object.<init> ()void>
  4: return

Attributes (count: 1):
Attribute "SourceFile", length:2, #14=""

More information about the Java-patches mailing list