problem in config/i386/jit.h

Per Bothner bothner at cygnus.com
Tue May 20 12:00:58 PDT 1997


> I'm having a problem with CALL_KAFFE_FUNCTION_VARARGS() on an i386
> (Freebsd 2.1) The inline asm uses %eax as a temporary register (for
> looping through the args to the method), but there is no way to
> declare this usage to the compiler.

Well, the:
	: "eax", "cc"
is supposed to tell gcc that eax is clobbered.  However. I am told that
it does not follow that Gcc canot use it as an input argument.

> Thus, as far as GCC can tell, it
> can use %eax for one of the "r" registers.  This just hasn't happened
> yet.  It bit me when I changed the -O to -g on the gcc command line

I ran into the same problem, and since I didn't see any obviou way to
fix it, and since people normally compile with -O2, it didn't seem urgent.

However, it really ought to be fixed, if we can.

> I tried adding a temp variable (in place of eax)

Did you try this?  If not, could you try it?

#define	CALL_KAFFE_FUNCTION_VARARGS(meth, obj, nargs, argptr, retval)	\
{ register int _nargs = nargs; \
	asm volatile ("							\n\
1:		cmpl $0,%3						\n\
		je 2f							\n\
		decl %3							\n\
		pushl (%4,%3,4)						\n\
		jmp 1b							\n\
2:									\n\
		pushl %2						\n\
		call *%1						\n\
		movl %%eax,%0						\n\
		" : "=r" (retval) :					\
	    "r" (meth->ncode), "r" (obj), "r" (_nargs), "r" (argptr)	\
	    : "eax", "cc" );						\
	asm volatile ("							\n\
		addl %0,%%esp" : : "r" (4*(nargs+1)) : "cc"); }

Please try this (for both optimized and not), and if it works,
send a patch to Tim.

	--Per Bothner
Cygnus Solutions     bothner at cygnus.com     http://www.cygnus.com/~bothner



More information about the kaffe mailing list