m68k calling conventions (long/boring for non-m68k users)
gback at cs.utah.edu
Sun Apr 4 10:54:33 PDT 1999
I don't really have the time and m68k knowledge to follow your discussions.
It appears to me, however, that we should fix the jit to follow the
standard C calling conventions on a given architecture and/or OS/assembler
combo, unless there's compelling reason not to do so.
I still don't understand Dave's point about Kaffe not saving callee-saved
registers. To my knowledge, there is *never* a case where a C function
directly calls a method jitted by the Kaffe jit. The only way in which
that can happen is through the callMethods. But those are C functions
where the compiler saves those registers.
Actually, thinking about it, maybe I see your problem: the compiler
might only save them if it is actually going to clobber them. It
may not realize that a register is clobbered by the function invoked
from callMethodX, but not in callMethodX itself. Is that what's happening?
If so, then we can of course fix it by saving the regs in the sysdepCallMethod;
but normally, it should suffice to specify that the registers were
clobbered in the asm clause. This should move gcc to generate save/restore
code for them. However, gcc is known to have problems with that sometimes.
(For instance, it would save/restore %ebx for pic code on the x86)
More information about the kaffe