This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: PR java/22084 [4.1 Regression] Divide_1 test case hangs
- From: Andrew Haley <aph at redhat dot com>
- To: Ranjit Mathew <rmathew at gmail dot com>
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>
- Date: Fri, 9 Sep 2005 12:59:42 +0100
- Subject: Re: PR java/22084 [4.1 Regression] Divide_1 test case hangs
- References: <17184.28128.315421.405242@zapata.pink><4321768A.3090701@gmail.com>
Ranjit Mathew writes:
>
> Hash: SHA1
>
> Andrew Haley wrote:
> > gcc at -O0 is now generating indexed loads for local variables via
> > register SP, rather than via BP as before. This is confusing the
> > disassembler in Java's divide overflow handler, which had never seen
> > such loads before. SP-indexed loads are 1 byte longer than BP-indexed
> > loads, so we need to increment PC.
>
> Thanks a lot for looking into this and fixing it. This patch
> seems to fix PR java/22166 and I get a clean testsuite run
> once again. I don't know how you manage to figure out these
> things, but awesome.
Really, this one wasn't so very difficult.
Stepping through the test case in gdb revealed that the instruction
being executed immediately after the divide instruction was corrupting
the stack. However, reading the assembly code showed that instruction
should never have been executed, so the question then was "how did we
get to that instruction?" And finding that was simply a matter of
single stepping through the divide overflow handler and the
calculation that adjusts the program counter before returning. It was
pretty obvious then that the return address was off by one.
The most time-consuming part of the whole exercise was trying to find
the page in the damned Pentium manual that describes the instruction
encodings. :-)
Andrew.