[kaffe] Re: NEED_sysdepCallMethod

Kiyo Inaba inaba at src.ricoh.co.jp
Wed Apr 14 22:26:02 PDT 2004


Riccardo and m68k-linux lovers,

on 4/14/04 10:10 AM, Kiyo Inaba at inaba at src.ricoh.co.jp wrote:
> I have slightly different behavior, but the result (kjc is not useable)
> is same. Let me investigate more...

OK, self compiling finished (after, say, 10 hours of configure/compiling)
and it started to compile javalib by using kjc. I attached a patch
against cvs-040408 (maybe ok for cvs-head also).

The problem is if you use automatic array for the argument of a function,
this function can not be inlined. I just backport macro version for
sysdepCallMethod.

Kiyo

diff -Naur kaffe-snap-040408.orig/config/m68k/linux/md.h kaffe-snap-040408/config/m68k/linux/md.h
--- kaffe-snap-040408.orig/config/m68k/linux/md.h	2004-03-10 00:15:35.000000000 +0900
+++ kaffe-snap-040408/config/m68k/linux/md.h	2004-04-14 22:10:48.000000000 +0900
@@ -51,46 +51,44 @@
  *	statement below is a 'because it works' version.
  */
 //	Linux version
-static inline void sysdepCallMethod(callMethodInfo *call)
-{
-	int extraargs[(call)->nrargs];
-	register int d0 asm ("d0");
-	register int d1 asm ("d1");
-	register double f0d asm ("fp0");
-	register float f0f asm ("fp0");
-	int *res;
-	int *args = extraargs;
-	int argidx;
-	for(argidx = 0; argidx < (call)->nrargs; ++argidx) {
-		if ((call)->callsize[argidx])
-			*args++ = (call)->args[argidx].i;
-		else
-			*args++ = (call)->args[argidx-1].j;
-	}
-	asm volatile ("jsr	%2@\n"
-		      : "=r" (d0), "=r" (d1)
-		      : "a" ((call)->function)
-		      : "cc", "memory");
-	if ((call)->retsize != 0) {
-		res = (int *)(call)->ret;
-	switch((call)->retsize) {
-	case 2:
-	  if ((call)->rettype == 'D')
-	    *(double*)res = f0d;
-	  else {
-		res[1] = d1;
-		res[0] = d0;
-	  }
-	  break;
-	case 1:
-	  if ((call)->rettype == 'F')
-	    *(double*)res = f0f;
-	  else
-		res[0] = d0;
-	  break;
-	}
-	}
-}
+#define sysdepCallMethod(CALL) do {				\
+	int extraargs[(CALL)->nrargs];				\
+	register int d0 asm ("d0");				\
+	register int d1 asm ("d1");				\
+	register double f0d asm ("fp0");			\
+	register float f0f asm ("fp0");				\
+	int *res;						\
+	int *args = extraargs;					\
+	int argidx;						\
+	for(argidx = 0; argidx < (CALL)->nrargs; ++argidx) {	\
+		if ((CALL)->callsize[argidx])			\
+			*args++ = (CALL)->args[argidx].i;	\
+		else						\
+			*args++ = (CALL)->args[argidx-1].j;	\
+	}							\
+	asm volatile ("jsr	%2@\n"				\
+	 : "=r" (d0), "=r" (d1)					\
+	 : "a" ((CALL)->function)				\
+	 : "cc", "memory");					\
+	if ((CALL)->retsize != 0) {				\
+		res = (int *)(CALL)->ret;			\
+	switch((CALL)->retsize) {				\
+	case 2:							\
+	  if ((CALL)->rettype == 'D')				\
+	    *(double*)res = f0d;				\
+	  else {						\
+		res[1] = d1;					\
+		res[0] = d0;					\
+	  }							\
+	  break;						\
+	case 1:							\
+	  if ((CALL)->rettype == 'F')				\
+	    *(double*)res = f0f;				\
+	  else							\
+		res[0] = d0;					\
+	  break;						\
+	}							\
+	}							\
+} while (0)
 
 #endif /* __m68k_linux_md_h */
-






More information about the kaffe mailing list