This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: optimizer fixlet
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Dalibor Topic <robilad at kaffe dot org>
- Date: 14 Sep 2005 15:18:12 -0600
- Subject: [gcjx] Patch: FYI: optimizer fixlet
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This fixes another bug that Dalibor discovered. gcjx was being
over-eager in doing an optimization on conditional branches.
I rebuilt classpath with 'gcjx -fverify' and it pointed out a number
of problems. I'll be looking into those next.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* bytecode/block.cc (optimize): Ensure conditional occurs just
before goto before removing.
Index: bytecode/block.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/bytecode/Attic/block.cc,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 block.cc
--- bytecode/block.cc 14 Sep 2005 03:59:04 -0000 1.1.2.4
+++ bytecode/block.cc 14 Sep 2005 21:14:59 -0000
@@ -69,6 +69,8 @@
ref_relocation last_but_one = *last_it;
if (last_but_one->conditional_p ()
&& last_but_one->get_target () == next_block
+ // The conditional must be directly before the goto.
+ && last_but_one->get_offset () + 1 == last->get_offset ()
&& last->get_kind () == reloc_goto)
{
// Remove the goto relocation and the byte representing
@@ -90,6 +92,8 @@
}
else if (last->conditional_p ()
&& last->get_target () == next_block->next_block
+ // The conditional must be directly before the goto.
+ && last->get_offset () == bytecode.size () - 1
&& ! next_block->relocations.empty ())
{
// We might also encounter this case if the next block