[kaffe] register spills
Kevin D. Kissell
kevink@mips.com
Wed Sep 10 23:34:01 2003
Register allocation in JIT3 seems to deliberately allocate
cyclicly through the full available register set. This was
presumably so that the last N values would always be
available for re-use. Unfortunately, this includes registers
used as temporary intermediate registers which will never,
ever, be reused. I found some bugs in the MIPS JIT3
configuration because of this behavior, which is why I
know about it.
One *can* reduce this by introducing one or two
"preferred" temp registers and modifying the JIT3
pseudo-instruction expansions to request those for temp
values, rather than just getting the next sequential register
via rreg_int() etc. I did that experimentally for MIPS,
and while it masked the bug I was chasing (but didn't fix
it - that had to be done elsewhere), it did not have the side
effect I expected of significantly improving performance.
Looking at the emitted JIT code, it *did* reduce the
number of spills, though. YMMV.
Regards,
Kevin K.
----- Original Message -----
From: "Gerlando Falauto" <iurly@writeme.com>
To: <kaffe@kaffe.org>
Sent: Thursday, September 11, 2003 1:38 AM
Subject: [kaffe] register spills
> Hi folks,
>
> I got some questions about how jit3 allocates registers.
> On a register-rich machine like the one I'm working on, one would
> expect simple code like (also known as Fibonacci):
>
> int a1=1, a2=0, an=0;
> for (int i = 1; i < 50; i++) {
> an = a1 + a2;
> a2 = a1;
> a1 = an;
> }
>
> to be translated into a loop working on registers only, without the
> overhead of recurrent spills and reloads.
> Well that's not the case for me, as I still have variables reloaded
> and spilled at the beginning and end of the basic block.
>
> Is that too much to ask? Does that have anything to do with
> registers being marked as global or not? Is there anything I could have
> done wrong?
>
> Unfortunately I haven't figured out how register allocation works in
> kaffe... any suggestions?
>
> Thanks in advance,
> Gerlando
>
>
> _______________________________________________
> kaffe mailing list
> kaffe@kaffe.org
> http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
>