kaffe m68k fixes

Richard Zidlicky kaffe@rufus.w3.org
Fri, 28 Dec 2001 23:12:05 +0100


Hello,

I have rebuilt the Redhat kaffe-1.0.6 src.rpm package for 
linux-m68k, a few fixes were required, patch appended.

Fixes:
- config/m68k/jit.h: fix trampoline macro
- config/m68k/jit-m68k.def: -\
- config/m68k/jit3-m68k.def:--+- fix generation of cmpal insn pattern
  generated invalid instruction previously (coredump)
- kaffe-1.0.6/kaffe/scripts/kaffe.in: fix ddd support, apparently
  output of ddd --version changed somewhat

tried the regression tests - still not perfect but at least it doesn't
segfault immediately. Are some of the failures expected?

# make check-TESTS
test -z "*.class *.fail *.out core *.core ExceptionTest" || rm -f *.class *.fail *.out core *.core ExceptionTest
PASS: HelloWorldApp.class.save
PASS: HelloWorldApp.java
PASS: TestIntLong.java
PASS: TestFloatDouble.java
PASS: DoubleNeg.java
PASS: DoublePrint.java
FAIL: DoubleComp.java
PASS: ModuloTest.java
PASS: LongNeg.java
PASS: FPUStack.java
PASS: Str.java
PASS: Str2.java
PASS: InternHog.java
PASS: IndexTest.java
FAIL: StackDump.java
PASS: tname.java
PASS: ttest.java
PASS: ThreadInterrupt.java
PASS: ThreadState.java
PASS: UncaughtException.java
PASS: IllegalWait.java
FAIL: Preempt.java
PASS: ReflectInterfaces.java
PASS: TestSerializable.java
PASS: TestSerializable2.java
PASS: TestCasts.java
PASS: Alias.java
PASS: NullPointerTest.java
PASS: NullInvoke.java
PASS: TableSwitch.java
FAIL: LostFrame.java
PASS: ConstructorTest.java
PASS: burford.java
PASS: IllegalInterface.java
PASS: GetInterfaces.java
PASS: IntfTest.java
PASS: SignedShort.java
PASS: CharCvt.java
PASS: BadFloatTest.java
PASS: ProcessTest.java
PASS: UDPTest.java
FAIL: SoTimeout.java
PASS: wc.java
PASS: FileTest.java
PASS: finalexc.java
PASS: finaltest.java
PASS: finaltest2.java
PASS: forNameTest.java
PASS: LoaderTest.java
PASS: ArrayForName.java
PASS: KaffeVerifyBug.java
PASS: Schtum.java
PASS: Reflect.java
PASS: MethodBug.java
PASS: Bean.java
FAIL: SortTest.java
PASS: HashTest.java
PASS: MapTest.java
PASS: URLTest.java
XFAIL: PropertiesTest.java
PASS: ReaderTest.java
PASS: CharArrayReaderTest.java
PASS: LineNumberReaderTest.java
PASS: BufferedReaderTest.java
PASS: ReaderReadVoidTest.java
PASS: ReflectInvoke.java
PASS: InvTarExcTest.java
PASS: CLTest.java
TestScript: line 4: 27657 Aborted                 (core dumped) $JAVA $* >$TMPRESULT 2>&1
FAIL: CLTestConc.java
TestScript: line 4: 27704 Illegal instruction     (core dumped) $JAVA $* >$TMPRESULT 2>&1
FAIL: CLTestJLock.java
PASS: CLTestLie.java
PASS: CLTestFindLoaded.java
PASS: ClassDeadLock.java
PASS: ExceptionTest.java
PASS: ExceptionTestClassLoader.java
PASS: ExceptionTestClassLoader2.java
PASS: TestClassRef.java
PASS: ClassGC.java
TestScript: line 4: 28116 Aborted                 (core dumped) $JAVA $* >$TMPRESULT 2>&1
FAIL: GCTest.java
PASS: ThreadLocalTest.java
FAIL: BeanBug.java
PASS: BitSetTest.java
FAIL: ExceptionInInitializerTest.java
PASS: InitTest.java
PASS: ProcessClassTest.java
FAIL: ProcessClassInst.java
TestScript: line 4: 28489 Aborted                 (core dumped) $JAVA $* >$TMPRESULT 2>&1
FAIL: ProcessClassStop.java
PASS: FindSystemClass.java
FAIL: ProcessClassLockTest.java
PASS: DoubleBug.java
FAIL: TestUnlock.java
PASS: MarkResetTest.java
PASS: HashtableTest1.java
PASS: ReflectMultiArray.java
PASS: ExecTest.java
FAIL: CatchDeath.java
PASS: ThreadStop.java
PASS: DeadThread.java
PASS: tthrd1.java
TestScript: line 4: 29077 Aborted                 (core dumped) $JAVA $* >$TMPRESULT 2>&1
FAIL: SoInterrupt.java
PASS: sysdepCallMethod.java
FAIL: DosTimeVerify.java
PASS: ZipVerify.java
PASS: TestNative.java
======================
18 of 104 tests failed
======================


--- kaffe-1.0.6/config/m68k/jit.h.rz	Mon Oct 18 07:14:27 1999
+++ kaffe-1.0.6/config/m68k/jit.h	Fri Dec 28 22:12:04 2001
@@ -61,19 +61,22 @@
         unsigned short call;
 	int fixup;
 	struct _methods* meth;
+	void** where;
 } methodTrampoline;
 
 extern void m68k_do_fixup_trampoline(void);
 
-#define FILL_IN_TRAMPOLINE(t,m)                                         \
+#define FILL_IN_TRAMPOLINE(t,m,w)                                         \
         do {                                                            \
                 (t)->call = 0x4eb9;	/* jsr abs.l */			\
                 (t)->fixup = (int)m68k_do_fixup_trampoline;		\
                 (t)->meth = (m);                                        \
+                (t)->where = (w);                                        \
         } while (0)
 
-#define FIXUP_TRAMPOLINE_DECL   Method** _pmeth
-#define FIXUP_TRAMPOLINE_INIT   (meth = *_pmeth)
+#define FIXUP_TRAMPOLINE_DECL   void** _data
+#define FIXUP_TRAMPOLINE_INIT  	(meth = (Method*)_data[0], \
+				 where = (void**)_data[1]) 
 
 /**/
 /* Register management information. */
--- kaffe-1.0.6/config/m68k/jit-m68k.def.rz	Mon Oct 11 19:46:53 1999
+++ kaffe-1.0.6/config/m68k/jit-m68k.def	Fri Dec 28 22:10:24 2001
@@ -290,15 +290,16 @@
 	debug(("cmpl %s, %s\n", regname(src1), regname(src2)));
 	assert_areg(src1);
 	assert_areg(src2);
+	/* src2 should be &7 but the next bit is set anyway */
 	WOUT = 0xB1C0 | (src2 << 9) | (MODE_a << 3) | (src1 & 7);
 }
 
 static inline void
 op_cmpil_ia(int imm, int src2)
 {
-	debug(("cmpil #%d, %s\n", imm, regname(src2)));
+	debug(("cmpal #%d, %s\n", imm, regname(src2)));
 	assert_areg(src2);
-	WOUT = 0x0C80 | (MODE_a << 3) | (src2 & 7);
+	WOUT = 0xb000 | 0x3c /* MODE_src_imm */ | 0x1c0 /* long */ | ((src2 & 7)<<9);
 	LOUT = imm;
 }
 
--- kaffe-1.0.6/config/m68k/jit3-m68k.def.rz	Fri Dec 28 21:03:39 2001
+++ kaffe-1.0.6/config/m68k/jit3-m68k.def	Fri Dec 28 22:07:52 2001
@@ -361,15 +361,17 @@
 	debug(("cmpl %s, %s\n", regname(src1), regname(src2)));
 	assert_areg(src1);
 	assert_areg(src2);
+	/* src2 should be &7 but the next bit is set anyway */
 	WOUT = 0xB1C0 | (src2 << 9) | (MODE_a << 3) | (src1 & 7);
 }
 
 static inline void
 op_cmpil_ia(int imm, int src2)
 {
+	long geni;
 	debug(("cmpil #%d, %s\n", imm, regname(src2)));
 	assert_areg(src2);
-	WOUT = 0x0C80 | (MODE_a << 3) | (src2 & 7);
+	WOUT = 0xb000 | 0x3c /* MODE_src_imm */ | 0x1c0 /* long */ | ((src2 & 7)<<9);
 	LOUT = imm;
 }
 
--- kaffe-1.0.6/kaffe/scripts/kaffe.in.rz	Sun Oct 17 07:45:25 1999
+++ kaffe-1.0.6/kaffe/scripts/kaffe.in	Fri Dec 28 20:01:35 2001
@@ -88,7 +88,7 @@
 	} >/tmp/.gdbinit.$$
 	exec "$KAFFE_DEBUG" -command /tmp/.gdbinit.$$ $KAFFE_LIBEXECDIR/@Kaffe_TRANSF@
 	rm -f /tmp/.gdbinit.$$;;
-    DDD*)
+    *DDD*)
 	# Tell DDD to start gdb within the correct working directory,
 	# and set up the specified argument list
 	{

Bye
Richard