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. 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 (the lack of optimization meant there were no free regs.) Can someone out there tell if this is a gcc problem (I'm using 2.6.3)? I can't imagine its supposed to deduce register usage, but.... The following patch basically drops %eax and just uses the 'nargs' register (thus nargs is *zero* after the call.) This solution isn't much better. I tried adding a temp variable (in place of eax), but gcc couldn't compile it (x86 doesn't have enough registers.) -Pat Index: jit.h =================================================================== RCS file: /n/fast/usr/lsrc/mach/CVS/kaffe/config/i386/jit.h,v retrieving revision 1.1.1.2 diff -u -b -r1.1.1.2 jit.h --- jit.h 1997-05-15 11:43:22-06 1.1.1.2 +++ jit.h 1997-05-19 15:50:32-06 @@ -15,24 +15,30 @@ /**/ /* Native function invocation. */ +/* WARNING: the 'nargs' argument will _probably_ be zeroed. */ /**/ #define CALL_KAFFE_FUNCTION_VARARGS(meth, obj, nargs, argptr, retval) \ - asm volatile (" \n\ - movl %3,%%eax \n\ -1: cmpl $0,%%eax \n\ - je 2f \n\ - decl %%eax \n\ - pushl (%4,%%eax,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") + 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 \ + " \ + : /*out:*/ "=r" (retval) \ + : /*in:*/ "r" (meth->ncode), \ + "r" (obj), \ + "r" (nargs), \ + "r" (argptr) \ + : /*clobber:*/ "eax", "cc" ); \ + asm volatile ("addl %0,%%esp" \ + : /*no out*/ \ + : /*in:*/ "r" (4*(nargs+1)) \ + : /*clobber:*/ "cc") \ #define CALL_KAFFE_FUNCTION(meth, obj) \ asm(" pusha \n\