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

Helmer Krämer hkraemer at freenet.de
Sat Jul 17 07:34:55 PDT 2004


On Sat, 17 Jul 2004 02:31:35 +0900 (JST)
Kiyo Inaba <inaba at src.ricoh.co.jp> wrote:

> 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 :-<

In order to check the array index, the jitter uses the
cbranch_offset_int instruction. Since the m68k backend
doesn't provide this instruction, the jitter uses the
following instructions instead:

load_offset_int(tmp, src, offs)
cmp_int(dst, src, tmp)
branch(l, gt)
call_soft(soft_badarrayindex)

Therefore, %d0 contains the value of the temp slot tmp
and the incorrect movel looks like %d0 is spilled onto
the stack in order to update the contents of the temp
slot on the stack, which is done between the cmp_int
and the branch.

Since the jitter has to make sure that an exception
handler can access the current value of the different
slots, it regularly spills the registers of the different
slots onto the stack. This is the type of spill that
happens between two instructions, just like the one
described earlier.

However, since temp slots are only used in order to
translate a single bytecode instruction, this type of
spill is not necessary for temp slots. Therefore I've
attached a patch that prevents this type of spill for
temp slots.

HTH,
Helmer 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jit3-patch
Url: http://kaffe.org/pipermail/kaffe/attachments/20040717/ae8af2bb/attachment-0002.txt 


More information about the kaffe mailing list