kaffe-0.8.2 m68k JIT bug (and fix)
Esa Salonen
es at vat-vai.valmet.com
Wed Mar 5 03:05:04 PST 1997
If M68K_RETURN_REF is not REG_a0 but the more usual d0 register,
then in some cases jit generated code is like:
moveal fp@(-20),a2
moveal a2,a4
movel a0,d0 <-- shoud be a4,d0
unlk fp
rts
a0 was some random value, and method returned that.
I assume that with M68K_RETURN_REF a0 you get something like
moveal fp@(-20),a2
moveal a2,a4
moveal a4,a0
movel a0,d0
unlk fp
rts
which works but movel a0,d0 is unnecessary, and could be easily eliminated
After following fix generated code looks like this:
(When M68K_RETURN_REF is d0)
moveal fp@(-20),a2
moveal a2,a4
movel a4,d0
unlk fp
rts
This works OK but I just wonder how those numerous copy instructions could be
optimized away.
*** kaffe-0.8.2/config/m68k/jit-m68k.def~ Sun Feb 23 19:01:11 1997
--- kaffe-0.8.2/config/m68k/jit-m68k.def Wed Mar 5 12:04:09 1997
***************
*** 2244,2250 ****
}
if (r != REG_d0) {
! op_movel_ad(REG_a0, REG_d0);
}
}
--- 2244,2251 ----
}
if (r != REG_d0) {
! op_movel_ad(r, REG_d0);
! /* op_movel_ad(REG_a0, REG_d0); bug! */
}
}
More information about the kaffe
mailing list