[kaffe] jit3 expert wanted! (Re: m68k/netbsd/jit3 trial)

Kiyo Inaba inaba at src.ricoh.co.jp
Fri Jul 16 10:31:35 PDT 2004

I wrote:
>I checkouted your version. And it works (which I mean, the compiled
>version stops at the same place as mine) on m68k/netbsd.

I continuing to debug jit3 for m68k. And if there are someone
who has some experience to debug jit3, I appreciate to get
some hint...

The compiled code of  'Runtime/loadLibrary' contains a funny
code segment as below.

0x28da14:       movel %a4@(8),%d0
0x28da18:       cmpl %d0,%d4
0x28da1a:       movel %d0,%fp@(-44)
0x28da1e:       bcsl 0x28da2a
0x28da24:       jsr 0x2b452 <soft_badarrayindex>        ; !!!!!
0x28da2a:       moveal %fp@(-32),%a0

Of course this is m68k asm and usual people don't want to read
them, but the core part is simple. At 0x28da1e, it checks a
flag and try to skip next instruction (subroutine call to
'soft_badarrayindex'). But, on m68k 'move' instruction changes
its flag, and that's why soft_badarrayindex is called :-<

So, I handcraft this code with the help of gdb to be

0x28da14:       movel %a4@(8),%d0
0x28da18:       movel %d0,%fp@(-44)
0x28da1c:       cmpl %d0,%d4
0x28da1e:       bcsl 0x28da2a
0x28da24:       jsr 0x2b452 <soft_badarrayindex>
0x28da2a:       moveal %fp@(-32),%a0

and with this change jit3 goes much further (322 methods out of 403
methods needed are compiled and executed)!!!

This code fragment is very similar to what we get from jit engine
for m68k, and if there are noone interested in jit3 debugging, I
have to (finally, sigh...) start reading jit3 engine source...

P.S. Of course, reading and understanding new code itself is joy :-)

More information about the kaffe mailing list