Callee-saved registers
Christian Wimmer
christian.wimmer at oracle.com
Thu Sep 19 09:40:14 PDT 2013
On 09/18/2013 01:35 PM, D.Sturm wrote:
> > The ABI that HotSpot uses internally has nothing to do with the
> "official" ABI for an architecture or platform. So you have to check
> what HotSpot expects you to do - since you certainly do not want to make
> changes to the HotSpot runtime.
> Ok, I'll have to check what the people working on the HotSpot ARMv8 port
> are doing then, I assumed they'd follow the documented ABI but clearly
> since we control the whole platform that's not necessary (apart from JNI
> calls?).
Again: No, HotSpot does not usually follow the documented native ABI,
and you want do not want to change the HotSpot ABI (even if you think it
is ridiculously inefficient).
Calls from Java code no native code (JNI calls and runtime calls) are
expensive anyway because of the thread state management (a stack walk
must be able to walk all Java frames and skip all native frames). The
different calling convention does not really matter for these calls.
> > No, there is currently no support in the register allocator for
> things like that. Basically, you need to find out if a register is used
> at all, and only spill it then in the prologue/epilogue. It shouldn't be
> difficult to find out if a register was ever used, but it is not
> implemented yet.
> Still not the most efficient solution because we'd have to always
> consider the worst case (i.e. if there's one path that uses 30 callee
> saved registers we have to spill all of them even if other paths only
> need 5). Wouldn't it be possible to tell the allocator that there are
> values in callee-saved registers that are alive across the whole method?
> Apart from a bit of bookkeeping to know the original position of each
> variable to restore it correctly, that seems relatively easy, or am I
> missing something?
There are ways to make callee save registers more efficient, but don't
worry about that until everything else works. It is an optimization, not
an essential feature. And yes, I have some ideas on how to implement it
and I'm happy to discuss it with you when the time comes.
-Christian
More information about the graal-dev
mailing list