[kaffe] CVS kaffe (dalibor): Fixes for m68k-netbsd with jit

Kaffe CVS cvs-commits at kaffe.org
Tue Jun 22 10:03:17 PDT 2004


PatchSet 4861 
Date: 2004/06/22 16:04:52
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fixes for m68k-netbsd with jit

2004-06-22  Kiyo Inaba <inaba at src.ricoh.co.jp>

        * config/m68k/common.h: ALIGNMENT_OF_SIZE is moved to each
        ports.
        * config/m68k/jit.h: packed attributes are added to fields of
        _methodTrampoline.
        * config/m68k/linux/md.h: ALIGNMENT_OF_SIZE is added. Some
        comments are revised.
        * config/m68k/netbsd1/config.frag: compiling option -O0 is
        added, because O2 does not work for the time being.
        * config/m68k/netbsd1/md.h: ALIGNMENT_OF_SIZE is added.
        sysddepCallMethod macro for netbsd was added.

Members: 
	ChangeLog:1.2428->1.2429 
	config/m68k/common.h:1.14->1.15 
	config/m68k/jit.h:1.14->1.15 
	config/m68k/linux/md.h:1.11->1.12 
	config/m68k/netbsd1/config.frag:1.7->1.8 
	config/m68k/netbsd1/md.h:1.7->1.8 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2428 kaffe/ChangeLog:1.2429
--- kaffe/ChangeLog:1.2428	Tue Jun 22 15:35:34 2004
+++ kaffe/ChangeLog	Tue Jun 22 16:04:52 2004
@@ -1,3 +1,16 @@
+2004-06-22  Kiyo Inaba <inaba at src.ricoh.co.jp>
+
+	* config/m68k/common.h: ALIGNMENT_OF_SIZE is moved to each
+	ports.
+	* config/m68k/jit.h: packed attributes are added to fields of
+	_methodTrampoline.
+	* config/m68k/linux/md.h: ALIGNMENT_OF_SIZE is added. Some
+	comments are revised.
+	* config/m68k/netbsd1/config.frag: compiling option -O0 is
+	added, because O2 does not work for the time being.
+	* config/m68k/netbsd1/md.h: ALIGNMENT_OF_SIZE is added.
+	sysddepCallMethod macro for netbsd was added.
+
 2004-06-22  Guilhem Lavaux  <guilhem at kaffe.org>
 
 	* configure.ac: Use AM_LCMESSAGES to check for LC_MESSAGES in
Index: kaffe/config/m68k/common.h
diff -u kaffe/config/m68k/common.h:1.14 kaffe/config/m68k/common.h:1.15
--- kaffe/config/m68k/common.h:1.14	Fri Dec 12 15:58:51 2003
+++ kaffe/config/m68k/common.h	Tue Jun 22 16:04:56 2004
@@ -27,16 +27,10 @@
 #include "atomicity.h"
 
 /*
- * Alignment in structure is 2 bytes packed.
- */
-#define ALIGNMENT_OF_SIZE(S)    (((S>1)?2:1))
-
-/*
  * Do an atomic compare and exchange.  The address 'A' is checked against
  * value 'O' and if they match it's exchanged with value 'N'.
  * We return '1' if the exchange is successful, otherwise 0.
  */
-
 
 #define COMPARE_AND_EXCHANGE(A, O, N)  (compare_and_swap((long int*) A, (long int) O, (long int) N)) 
 
Index: kaffe/config/m68k/jit.h
diff -u kaffe/config/m68k/jit.h:1.14 kaffe/config/m68k/jit.h:1.15
--- kaffe/config/m68k/jit.h:1.14	Wed May 19 10:32:33 2004
+++ kaffe/config/m68k/jit.h	Tue Jun 22 16:04:57 2004
@@ -53,8 +53,8 @@
 typedef struct _methodTrampoline {
         unsigned short call;
 	int fixup __attribute__ ((packed));
-	struct _methods* meth;
-	void** where;
+	struct _methods* meth __attribute__ ((packed));
+	void** where __attribute__ ((packed));
 } methodTrampoline;
 
 extern void m68k_do_fixup_trampoline(void);
Index: kaffe/config/m68k/linux/md.h
diff -u kaffe/config/m68k/linux/md.h:1.11 kaffe/config/m68k/linux/md.h:1.12
--- kaffe/config/m68k/linux/md.h:1.11	Mon Jun  7 19:14:21 2004
+++ kaffe/config/m68k/linux/md.h	Tue Jun 22 16:04:57 2004
@@ -1,6 +1,6 @@
 /*
  * m68k/linux/md.h
- * Linux m68k configuration information.
+ * Linux/m68k configuration information.
  *
  * Copyright (c) 1996, 1997
  *	Transvirtual Technologies, Inc.  All rights reserved.
@@ -26,9 +26,15 @@
 #endif
 
 /*
- * Redefine stack pointer offset.
+ * Alignment in structure is 2 bytes packed.
+ */
+#define ALIGNMENT_OF_SIZE(S)    (((S>1)?2:1))
+
+/*
+ * Stack offset.
+ * This is the offset into the setjmp buffer where the stack pointer is
+ * stored.
  */
-#undef  SP_OFFSET
 #define SP_OFFSET	14
 
 /**/
@@ -57,14 +63,8 @@
 /*
  * sysdepCallMethod supports:
  *
- *	Calling sequences for linux and netbsd1 are same, except for
- *	the place of return values. The float/double values are in
- *	fp0 (linux) or d0/d1 (netbsd1).
- *
- *	Still I do not understand 'asm' statement well, and the
- *	statement below is a 'because it works' version.
+ *	Linux version
  */
-//	Linux version
 #define sysdepCallMethod(CALL) do {				\
 	int extraargs[(CALL)->nrargs];				\
 	register int d0 asm ("d0");				\
Index: kaffe/config/m68k/netbsd1/config.frag
diff -u kaffe/config/m68k/netbsd1/config.frag:1.7 kaffe/config/m68k/netbsd1/config.frag:1.8
--- kaffe/config/m68k/netbsd1/config.frag:1.7	Fri Jan  2 19:55:38 2004
+++ kaffe/config/m68k/netbsd1/config.frag	Tue Jun 22 16:04:58 2004
@@ -1,7 +1,7 @@
 #
 # m68k/Netbsd1 configuration.
 #
-CFLAGS="$CFLAGS -fno-omit-frame-pointer"
+CFLAGS="$CFLAGS -O0 -fno-omit-frame-pointer"
 LDFLAGS="$LDFLAGS -lm68k"
 if [ "$cross_compiling" = yes ]; then
   ac_cv_c_char_unsigned=${ac_cv_c_char_unsigned='no'}
Index: kaffe/config/m68k/netbsd1/md.h
diff -u kaffe/config/m68k/netbsd1/md.h:1.7 kaffe/config/m68k/netbsd1/md.h:1.8
--- kaffe/config/m68k/netbsd1/md.h:1.7	Mon Jun  7 19:14:21 2004
+++ kaffe/config/m68k/netbsd1/md.h	Tue Jun 22 16:04:58 2004
@@ -1,6 +1,6 @@
 /*
  * m68k/netbsd1/md.h
- * netbsd/m68k specific functions.
+ * netbsd/m68k configuration information.
  *
  * Copyright (c) 1996, 1997
  *	Transvirtual Technologies, Inc.  All rights reserved.
@@ -16,12 +16,17 @@
 
 #include "m68k/common.h"
 #include "m68k/threads.h"
-#include "m68k/sysdepCallMethod.h"
 
 /*
- * Redefine stack pointer offset.
+ * Alignment in structure is 4 bytes packed
+ */
+#define ALIGNMENT_OF_SIZE(S)    ((S) < 4 ? (S) : 4)
+
+/*
+ * Stack offset.
+ * This is the offset into the setjmp buffer where the stack pointer is
+ * stored.
  */
-#undef  SP_OFFSET
 #define SP_OFFSET       2
 
 /**/
@@ -40,4 +45,66 @@
 #include "jit-md.h"
 #endif
 
-#endif
+/*
+ * sysdepCallMethod supports:
+ *
+ *	NetBSD version
+ *	For NetBSD the 'extraargs' magic does not work, and I still
+ *	have to use fully asm version. Also, with optimization A2
+ *	register is contaminated when coming back from subroutine
+ *	sysdepCallMethod calls, and I split the code into two parts.
+ */
+
+#define	sysdepCallMethod(CALL)					  \
+	asm volatile ("						\n\
+	1:							\n\
+		cmp.l	#0,%0					\n\
+		beq	3f					\n\
+		subq.l	#1,%0					\n\
+		cmp.b	#0,(%2,%0.l)				\n\
+		beq	1b					\n\
+		cmp.b	#1,(%2,%0.l)				\n\
+		beq	2f					\n\
+		move.l	4(%1,%0.l*8),-(%/sp)			\n\
+	2:							\n\
+		move.l	(%1,%0.l*8),-(%/sp)			\n\
+		jmp	1b					\n\
+	3:							\n\
+		jsr	(%3)					\n\
+      " :							  \
+	: "r" ((CALL)->nrargs),					  \
+	  "a" ((CALL)->args),					  \
+	  "a" ((CALL)->callsize),				  \
+	  "a" ((CALL)->function)				  \
+	: "d0", "d1", "fp0", "cc", "memory");			  \
+	asm volatile ("						\n\
+		cmp.b	#2,%0					\n\
+		bne	5f					\n\
+		cmp.b	#0x44,%1				\n\
+		bne	4f					\n\
+		fmove.d	%/fp0,(%2)				\n\
+		jmp	7f					\n\
+	4:							\n\
+		move.l	%/d1,4(%2)				\n\
+		move.l	%/d0,(%2)				\n\
+		jmp	7f					\n\
+	5:							\n\
+		cmp.b	#1,%0					\n\
+		bne	7f					\n\
+		cmp.b	#0x46,%1				\n\
+		bne	6f					\n\
+		fmove.s	%/fp0,(%2)				\n\
+		jmp	7f					\n\
+	6:							\n\
+		move.l	%/d0,(%2)				\n\
+	7:							  \
+      " :							  \
+	: "m" ((CALL)->retsize),				  \
+	  "m" ((CALL)->rettype),				  \
+	  "a" ((CALL)->ret)					  \
+	: "d0", "d1", "fp0", "cc", "memory");			  \
+	asm volatile ("						\n\
+		add.w %0,%/sp					\n\
+	" : : "r" ((CALL)->argsize * sizeof(jint)) : "cc")
+
+#endif /* __m68k_netbsd1_md_h */




More information about the kaffe mailing list