[kaffe] [PATCH] m68k jit3 (was: jit3 expert wanted!)

Kiyo Inaba inaba at src.ricoh.co.jp
Tue Jul 20 19:09:29 PDT 2004


Hi all,

I made patch file to solve some problem on m68k jit3. In this patch
you can find out two modifications. The first one is suggested by
Helmer not to emit code for spilling unneeded registers. The second
one is to comment out a function which emits unimplemented code.
(Usually, 68k machine instruction is so orthogonal, but cmpi inst
can not accept address registers...)

Even with this patch applied, m68k/netbsd/jit3 does not work properly,
but now it compiles 396 methods out of 403 needed for HelloWorldApp.
It is a big improvement compared with 98 methods compiled without this
patch.

Current output is
	java.lang.ClassFormatError: Bad magic number 0x0
	   at java.lang.Class.forName (Class.java)

Sigh...

Kiyo

diff -Naur kaffe-snap-040708.orig/ChangeLog kaffe-snap-040708/ChangeLog
--- kaffe-snap-040708.orig/ChangeLog	2004-07-07 21:58:43.000000000 +0900
+++ kaffe-snap-040708/ChangeLog	2004-07-15 20:14:49.000000000 +0900
@@ -1,3 +1,14 @@
+2004-07-21  Kiyo Inaba <inaba at src.ricoh.co.jp>
+
+	* kaffe/kaffevm/jit3/machine.c:
+	Remove unneeded (and incorrect) code emitted.
+	This mod is suggested by Helmer.
+
+	* config/m68k/jit3-icode.h,
+	config/m68k/jit3-m68k.def:
+	Comment out cmpr_xRC definition. It emits an unimplemented
+	machine	code for 68030.
+
 2004-07-07  Jim Huang <jserv at kaffe.org>
 
  	* libraries/javalib/java/awt/Graphics.java:
diff -Naur kaffe-snap-040708.orig/config/m68k/jit3-icode.h kaffe-snap-040708/config/m68k/jit3-icode.h
--- kaffe-snap-040708.orig/config/m68k/jit3-icode.h	2001-06-18 01:39:10.000000000 +0900
+++ kaffe-snap-040708/config/m68k/jit3-icode.h	2004-07-21 10:09:40.000000000 +0900
@@ -137,14 +137,14 @@
 
 #define HAVE_add_ref_const		addr_RRC
 #define HAVE_sub_ref_const		subr_RRC
-#define HAVE_cmp_ref_const		cmpr_xRC
+#undef	HAVE_cmp_ref_const
 #define HAVE_pusharg_ref_const		pushr_xCC
 #define HAVE_load_offset_ref		loadr_RRC
 #define HAVE_store_offset_ref		storer_xRRC
 
 #define HAVE_add_ref_const_rangecheck(v)	(1)
 #define HAVE_sub_ref_const_rangecheck(v)	(1)
-#define HAVE_cmp_ref_const_rangecheck(v)	(1)
+#undef	HAVE_cmp_ref_const_rangecheck(v)
 #define HAVE_pusharg_ref_const_rangecheck(v)	(1)
 #define HAVE_load_offset_ref_rangecheck(v)	m68k_s16_rangecheck(v)
 #define HAVE_store_offset_ref_rangecheck(v)	m68k_s16_rangecheck(v)
diff -Naur kaffe-snap-040708.orig/config/m68k/jit3-m68k.def kaffe-snap-040708/config/m68k/jit3-m68k.def
--- kaffe-snap-040708.orig/config/m68k/jit3-m68k.def	2004-06-01 02:15:10.000000000 +0900
+++ kaffe-snap-040708/config/m68k/jit3-m68k.def	2004-07-21 10:11:05.000000000 +0900
@@ -1921,6 +1921,12 @@
 	op_cmpl_dd(r2, r1);
 }
 
+#if 0
+/*
+ * Since this function generates an unimplemented instruction, and
+ * tentatively commented out.
+ */
+
 define_insn(cmp_ref_const, cmpr_xRC)
 {
 	int v = const_int(2);
@@ -1933,6 +1939,7 @@
 		op_tst_a(r);
 	}
 }
+#endif
 
 define_insn(cmp_ref, cmpr_xRR)
 {
diff -Naur kaffe-snap-040708.orig/kaffe/kaffevm/jit3/machine.c kaffe-snap-040708/kaffe/kaffevm/jit3/machine.c
--- kaffe-snap-040708.orig/kaffe/kaffevm/jit3/machine.c	2004-07-06 01:40:45.000000000 +0900
+++ kaffe-snap-040708/kaffe/kaffevm/jit3/machine.c	2004-07-21 00:55:29.000000000 +0900
@@ -838,7 +838,7 @@
 					 * in case its used in a subsequent
 					 * basic block.
 					 */
-					if( t->jflags.ANY )
+					if( t->jflags.ANY && (t->u[i].slot<tempinfo->slot))
 					{
 						spillAndUpdate(t->u[i].slot,
 							       true);




More information about the kaffe mailing list