m68k calling conventions

Archie Cobbs archie at whistle.com
Wed Mar 31 10:37:17 PST 1999

David Jones writes:
> Kaffe's calling convention is NOT compatible with the standard C calling
> convention, because Kaffe does not respect callee-save registers.  Rather,
> Kaffe assumes that all registers will be clobbered after a call to a function.
> For this reason, Kaffe cannot directly interwork with C functions.  If it
> could, then this sysdepCallMethod stuff likely wouldn't be needed at all.

I'm not sure I understand "Kaffe cannot directly interwork with C
functions".  As I understand it, the reason sysdepCallMethod()
exists at all is because there's no way in C to portably construct
an argument list to a function at run time. That is, you can't say
"Call this function with these arguments" where "these arguments"
are computed at run-time (unless the function takes a va_list,
which most don't). The whole point of sysdepCallMethod() is to
interact with C functions, eg., JNI routines.

Can you point to a specific example of where kaffe doesn't respect
the callee-save registers convention? I think almost every system
in the world has callee-save registers (though which registers are
considered 'scratch' may be different for different OS's). Seems
like Kaffe should also respect callee-save if it doesn't already.
For maximum portablility kaffe should push/pop all registers it uses.

> Since we are not compatible with the C calling convention, we are free to use
> whatever convention we want.  It makes sense to me in this case to use the
> same conventions on NetBSD as on Linux.  To do otherwise simply creates
> unnecessary OS dependencies.

I don't understand this. How is kaffe on NetBSD different from what
NetBSD normally does?


Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com

More information about the kaffe mailing list