[kaffe] jit3 move_register

Helmer Krämer hkraemer at freenet.de
Thu Jul 29 05:20:10 PDT 2004


Hi,

while having a closer look at the jit3 engine to find out what
broke the m68k backend, I also noticed a few other things that
might help e.g. mipsel.

First of all, move_register() seems to pass wrong values to the
backend's HAVE_move_register_foo:

 #if defined(HAVE_move_register_int)
 	if (reginfo[toreg].type & (Rint|Rsubint)) {
		HAVE_move_register_int(toreg, fromreg);
 		return (1);
 	}
 	else
 #endif

The values passed to the HAVE_move_register_foo are the indices
for the reginfo array. However, I think it would be correct to
pass the regno field of the register instead:
	...
	HAVE_move_register_int(reginfo[toreg].regno, reginfo[fromreg].regno);
	...
Since these are the same values that are returned by slotRegister().

With the attached patch applied, it should be possible to add a
HAVE_move_register_float to the mipsel backend, which in turn might
save a few spills when allocating a floating point register.

Comments?

Regards,
Helmer 
-------------- next part --------------
Index: kaffe/kaffevm/jit3/registers.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/jit3/registers.c,v
retrieving revision 1.15
diff -u -r1.15 registers.c
--- kaffe/kaffevm/jit3/registers.c	6 Jul 2004 15:57:15 -0000	1.15
+++ kaffe/kaffevm/jit3/registers.c	29 Jul 2004 11:55:30 -0000
@@ -42,7 +42,7 @@
  */
 kregs reginfo[] = {
 	REGISTER_SET
-	{ /* BAD */	0, 0, 0, 0, 0, 0 }
+	{ /* BAD */	0, 0, 0, 0, 0, 0, 0 }
 };
 
 /**
@@ -210,35 +210,35 @@
 {
 #if defined(HAVE_move_register_long)
 	if (reginfo[toreg].type & Rlong) {
-		HAVE_move_register_long(toreg, fromreg);
+		HAVE_move_register_long(reginfo[toreg].regno, reginfo[fromreg].regno);
 		return (1);
 	}
 	else
 #endif
 #if defined(HAVE_move_register_int)
 	if (reginfo[toreg].type & (Rint|Rsubint)) {
-		HAVE_move_register_int(toreg, fromreg);
+		HAVE_move_register_int(reginfo[toreg].regno, reginfo[fromreg].regno);
 		return (1);
 	}
 	else
 #endif
 #if defined(HAVE_move_register_ref)
 	if (reginfo[toreg].type & Rref) {
-		HAVE_move_register_ref(toreg, fromreg);
+		HAVE_move_register_ref(reginfo[toreg].regno, reginfo[fromreg].regno);
 		return (1);
 	}
 	else
 #endif
 #if defined(HAVE_move_register_double)
 	if (reginfo[toreg].type & Rdouble) {
-		HAVE_move_register_double(toreg, fromreg);
+		HAVE_move_register_double(reginfo[toreg].regno, reginfo[fromreg].regno);
 		return (1);
 	}
 	else
 #endif
 #if defined(HAVE_move_register_float)
 	if (reginfo[toreg].type & Rfloat) {
-		HAVE_move_register_float(toreg, fromreg);
+		HAVE_move_register_float(reginfo[toreg].regno, reginfo[fromreg].regno);
 		return (1);
 	}
 	else


More information about the kaffe mailing list