This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: java/5794: gcj fails to verify .class file generated by Sun JDK1.4 compiler
- From: Per Bothner <per at bothner dot com>
- To: Jesse Rosenstock <jmr at ugcs dot caltech dot edu>
- Cc: java-patches at gcc dot gnu dot org
- Date: Wed, 11 Sep 2002 12:06:24 -0700
- Subject: Re: java/5794: gcj fails to verify .class file generated by Sun JDK1.4 compiler
- References: <20020904194416.86E5A84063@euro.ugcs.caltech.edu>
Jesse Rosenstock wrote:
In case the patch is ok, a ChangeLog entry:
2002-09-03 Jesse Rosenstock <jmr@ugcs.caltech.edu>
For PR java/5794:
* verify.c (verify_jvm_instructions): Don't require that the
exception handler target doesn't overlap the range it's guarding.
For OPCODE_jsr, only push the return label if a ret instruction
for the jsr has been reached.
Could you split up the patch, and check them in separately? (You don't
need to re-run the testsuite separately.)
--- verify.c 4 Jun 2002 20:32:08 -0000 1.48
+++ verify.c 4 Sep 2002 19:19:23 -0000
@@ -470,9 +470,8 @@
if (start_pc < 0 || start_pc >= length
|| end_pc < 0 || end_pc > length || start_pc >= end_pc
|| handler_pc < 0 || handler_pc >= length
- || (handler_pc >= start_pc && handler_pc < end_pc)
|| ! (instruction_bits [start_pc] & BCODE_INSTRUCTION_START)
|| (end_pc < length &&
! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START))
|| ! (instruction_bits [handler_pc] & BCODE_INSTRUCTION_START))
I'm still not really comfortable with this. I'm be happier with a
warning, at least until I get a better explaination of why the bytecode
makes sense.
@@ -1323,9 +1322,10 @@
if (TREE_VEC_ELT (return_map, len) != TYPE_UNUSED)
type_map[len] = TREE_VEC_ELT (return_map, len);
}
current_subr = LABEL_SUBR_CONTEXT (target);
- PUSH_PENDING (return_label);
+ if (RETURN_MAP_ADJUSTED (return_map))
+ PUSH_PENDING (return_label);
}
INVALIDATE_PC;
}
This seems reqasonable. Please check it in.
Tom Tromey wrote:
> Per will really have to review it. He wrote the verifier in gcj and
> remains the only person who fully understands it.
While I wrote it, I can't pretend to fully understand it. I don't think
I fully understood it even as I was writing it - verification of
subroutines is really nasty and tricky.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/