PR java/22084 [4.1 Regression] Divide_1 test case hangs
Andrew Haley
aph@redhat.com
Fri Sep 9 11:58:00 GMT 2005
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.
More information about the Java-patches
mailing list