[kaffe] compiling for m68k with optimization works.

Kiyo Inaba inaba@src.ricoh.co.jp
Mon May 5 22:22:01 2003


Hi all,
I've checked what makes -O for m68k-linux broken and finally found
the code (sorry, not the 'reason') which makes it. The patch is
attached in the tail of this mail, but in short it is made by
one assertion deleted in kaffe/kaffevm/support.c. I guess this
deletion may cause some (un-expected) optimization on m68k-linux
and breaks entire system.

>From the code, this assertion may not needed but for this purpose
could you consider to put it back?

My test environment:
 m68k-linux 2.0.33pl1

 bash$ m68k-linux-gcc -v
 Reading specs from /proj/cross1/lib/gcc-lib/m68k-linux/2.95.3/specs
 gcc version 2.95.3 20010315 (release)

And, Tony, could you please let me know whether -O works fine with
or without this patch? If it works without this patch on Amiga, I
also want to know gcc version you are using.

Kiyo
------------------------------------------------------------------
Patches for 'config.frag' and 'support.c' are the essential. Patches
for 'config-mem.h' and 'getifaddrs.c' are local patches which make
compilation work.

diff -u -r kaffe-snap-030501/config/m68k/linux/config.frag kaffe-snap-test/config/m68k/linux/config.frag
--- kaffe-snap-030501/config/m68k/linux/config.frag	Sat Dec 18 14:09:34 1999
+++ kaffe-snap-test/config/m68k/linux/config.frag	Tue May  6 13:46:46 2003
@@ -3,8 +3,8 @@
 #
 Khost_cpu=m68k
 Khost_os=linux
-CFLAGS="-g -fno-omit-frame-pointer"
-#CFLAGS="-g -O -fno-omit-frame-pointer"
+#CFLAGS="-g -fno-omit-frame-pointer"
+CFLAGS="-g -O -fno-omit-frame-pointer"
 if [ "$cross_compiling" = yes ]; then
 # if we use cross environment, following values may not be detected.
   ac_cv_alignmentof_voidp=${ac_cv_alignmentof_voidp='2'}
diff -u -r kaffe-snap-030501/kaffe/kaffevm/support.c kaffe-snap-test/kaffe/kaffevm/support.c
--- kaffe-snap-030501/kaffe/kaffevm/support.c	Tue May  6 11:34:59 2003
+++ kaffe-snap-test/kaffe/kaffevm/support.c	Tue May  6 13:53:59 2003
@@ -816,6 +816,8 @@
 	call.ret = ret;
 
 #if defined(TRANSLATOR)
+	assert((func == (METHOD_NATIVECODE(meth)))
+	       || (func == (((Hjava_lang_Object*)obj)->dtable->method[meth->idx])));
 	call.function = func;
 
 	/* GCDIAG wipes free memory with 0xf4... */
diff -u -r kaffe-snap-030501/config/config-mem.h kaffe-snap-test/config/config-mem.h
--- kaffe-snap-030501/config/config-mem.h	Tue May  6 11:33:42 2003
+++ kaffe-snap-test/config/config-mem.h	Tue May  6 13:33:07 2003
@@ -46,10 +46,10 @@
 /* 
  * Some systems (Linux) do not declare swab in any standard header file
  */
-/*
 extern void swab(const void *from, void *to, size_t n);
-*/
+/*
 extern void swab(const void *from, void *to, ssize_t n);
+*/
 #endif
 
 #endif
diff -u -r kaffe-snap-030501/replace/getifaddrs.c kaffe-snap-test/replace/getifaddrs.c
--- kaffe-snap-030501/replace/getifaddrs.c	Fri Feb 21 18:51:11 2003
+++ kaffe-snap-test/replace/getifaddrs.c	Tue May  6 13:35:18 2003
@@ -17,8 +17,8 @@
 
 #if defined(HAVE_GETIFADDRS)
 
+/*
 #elif defined(linux)
-
 #if !defined(__set_errno)
 #define __set_errno(x) errno = x
 #endif
@@ -28,7 +28,7 @@
 #endif
 
 #include "ifaddrs_linux.c"
-
+ */
 #else
 
 #include <errno.h>