[kaffe] Re: jit3 expert wanted! (again)

Kiyo Inaba inaba at src.ricoh.co.jp
Fri Jul 23 01:49:06 PDT 2004


Sorry for my little knowledge of jit3, I found 1 more similar bug in
jit3 for m68k.

While trying to execute HelloWorldApp, it uses java/lang/String and
for m68k/jit3 goes to wrong way compared with any other correct

The original java code is
public String(StringBuffer sb) {
        synchronized (sb) {
                if (sb.value.length > sb.count + STRINGBUFFER_SLOP) {
                        value = new char[sb.count];
                        offset = 0;
                        count = sb.count;
                        sb.getChars(0, count, value, 0);
                else {
                        value = sb.value;
                        offset = 0;
                        count = sb.count;
                        sb.shared = true;

And 'correct' implementation goes to else clause of this function but
for m68k/jit3, it tries to use the clause which includes 'getChars'.

So getting into the machine instruction of m68k, 

0x29343c:       jsr 0x2930c <lockObject>
0x293442:       addql #4,%sp
0x293444:       movel %a3,%fp@(-28)
0x293448:       movel %a5,%fp@(-8)
0x29344c:       movel %a4,%fp@(-4)
0x293450:       moveal %a3@(12),%a0
0x293454:       movel %a0,%fp@(-28)
0x293458:       moveal %fp@(-28),%a0
0x29345c:       movel %a0@(8),%d0
0x293460:       movel %d0,%fp@(-28)
0x293464:       movel %a3,%fp@(-24)
0x293468:       movel %a3@(8),%d0
0x29346c:       addl #32,%d0
0x293472:       movel %fp@(-28),%d1
0x293476:       cmpl %d0,%d1
0x293478:       movel %d1,%fp@(-28)
0x29347c:       movel %d0,%fp@(-24)
0x293480:       blel 0x29356c

And again, the two move instructions at 0x293478 and 0x29347c destroy
the attempt made at 0x293476...

I think similar modification what Helmer showed may solve this problem,
but I can not figure out where exactly I have to modify.


More information about the kaffe mailing list