[kaffe] Why does Kaffe's register allocator spill slots in theboundary of basic blocks?

Helmer Krämer hkraemer at freenet.de
Fri Nov 5 03:19:29 PST 2004


On Thu, 4 Nov 2004 01:44:37 +0800
"Bytecode" <bytecode at tom.com> wrote:

> 
> On Thu, 4 Nov 2004 00:16:20 +0800
> "Bytecode" <bytecode at tom.com> wrote:
> 
> > 
> > I'm optimizing the register allocation mechod in kaffe.
> > I find that the current register allocator spills "dirty" slots in the 
> > exit of each basic block by calling function endBlock(). Why?
> 
> Kaffe's register allocator (the one in jit3) does only do global register
> allocation for a limited number of local variables. To ensure that
> subsequent code can access the elements of the operand stack that are still
> valid at the end of a basic block, their slots have to be spilled. Same
> thing for local variables that were not assigned a global register.
> 
> -------------------------------------
> Now that the elements of the stack are in the registers, we can use the
> registers for latter operations directly. There is no need to spii them.
> In the entry of each basic block the function startBlock() will invalidate
> the relation between all slots and registers. I cannot understand it .

If a basic block B has more than one predecessor, you have to make
sure that B can access the elements of the operand stack no matter
what predecessor was executed before B. jit3 does this by spilling
the registers whenever a basic block is left.

Regards,
Helmer




More information about the kaffe mailing list