[kaffe] CVS kaffe (dalibor): Small fix for m68k build problems
Kaffe CVS
Kaffe Mailing List <kaffe@kaffe.org>
Tue Dec 9 04:54:02 2003
PatchSet 4208
Date: 2003/12/09 12:37:25
Author: dalibor
Branch: HEAD
Tag: (none)
Log:
Small fix for m68k build problems
2003-12-09 Dalibor Topic <robilad@kaffe.org>
* config/m68k/common.h
(sysdepCallMethod) Converted to inline function.
(COMPARE_AND_EXCHANGE) Call compare_and_swap inline function
from atomicity.h.
* config/m68k/atomicity.h: New file from GNU libc.
* config/Makefile.am
(EXTRA_DIST) Added config/m68k/atomicity.h.
* config/Makefile.in,
aclocal.m4:
Regenerated.
* THIRDPARTY: Added information on m68k atomic compare_and_swap.
Members:
ChangeLog:1.1798->1.1799
THIRDPARTY:1.5->1.6
aclocal.m4:1.75->1.76
config/Makefile.am:1.27->1.28
config/Makefile.in:1.94->1.95
config/m68k/atomicity.h:INITIAL->1.1
config/m68k/common.h:1.10->1.11
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1798 kaffe/ChangeLog:1.1799
--- kaffe/ChangeLog:1.1798 Mon Dec 8 17:06:23 2003
+++ kaffe/ChangeLog Tue Dec 9 12:37:25 2003
@@ -1,3 +1,41 @@
+2003-12-09 Dalibor Topic <robilad@kaffe.org>
+
+ * config/m68k/common.h
+ (sysdepCallMethod) Converted to inline function.
+ (COMPARE_AND_EXCHANGE) Call compare_and_swap inline function
+ from atomicity.h.
+
+ * config/m68k/atomicity.h: New file from GNU libc.
+
+ * config/Makefile.am
+ (EXTRA_DIST) Added config/m68k/atomicity.h.
+
+ * config/Makefile.in,
+ aclocal.m4:
+ Regenerated.
+
+ * THIRDPARTY: Added information on m68k atomic compare_and_swap.
+
+2003-12-08 Dalibor Topic <robilad@kaffe.org>
+
+ * Makefile.am
+ (EXTRA_DIST) Added ChangeLog.6, ChangeLog.7 and ChangeLog.8.
+
+ * Makefile.in,
+ aclocal.m4,
+ config/Makefile.in,
+ kaffe/Makefile.in,
+ kaffe/kaffe/Makefile.in,
+ kaffe/kaffevm/Makefile.in,
+ kaffe/kaffevm/gcj/Makefile.in,
+ kaffe/scripts/Makefile.in,
+ libraries/clib/Makefile.in,
+ libraries/javalib/Makefile.am,
+ libraries/javalib/Makefile.in,
+ test/internal/Makefile.in,
+ test/regression/Makefile.in:
+ Regenerated.
+
2003-12-08 Dalibor Topic <robilad@kaffe.org>
* Makefile.am
Index: kaffe/THIRDPARTY
diff -u kaffe/THIRDPARTY:1.5 kaffe/THIRDPARTY:1.6
--- kaffe/THIRDPARTY:1.5 Wed Dec 3 15:15:27 2003
+++ kaffe/THIRDPARTY Tue Dec 9 12:37:26 2003
@@ -152,10 +152,19 @@
At the time of writing, Kaffe uses getaddrinfo 1.6.1.
+* M68k atomic compare_and_swap
+
+Taken from GNU libc 2.3.2, which is licensed under the GNU Lesser General
+Public License. See file license-lesser.terms for details.
+
+More information on GNU libc is available at
+http://www.gnu.org/software/libc/libc.html.
+
* Configure.in tests for isinf, isnan, finite
Taken from Sablotron 1.0, which is dually licensed licensed under MPL 1.1
-and GPL. It is available from http://www.gingerall.cz/charlie/ga/xml/p_sab.xml
+and GPL. It is available from
+http://www.gingerall.cz/charlie/ga/xml/p_sab.xml.
* valist.m4
@@ -189,6 +198,9 @@
do so, delete this exception statement from your version."
See license.terms for details of the GNU GPL.
+
+More information on GNU Crypto is available from
+http://www.gnu.org/software/gnu-crypto/.
* iconv.m4, lib-ld.m4, lib-link.m4, lib-prefix.m4
Index: kaffe/aclocal.m4
diff -u kaffe/aclocal.m4:1.75 kaffe/aclocal.m4:1.76
--- kaffe/aclocal.m4:1.75 Mon Dec 8 17:06:24 2003
+++ kaffe/aclocal.m4 Tue Dec 9 12:37:26 2003
@@ -8723,7 +8723,7 @@
AU_DEFUN([fp_WITH_DMALLOC], [AM_WITH_DMALLOC])
# ----------------------------------------------------------------------------
-# $Id: aclocal.m4,v 1.75 2003/12/08 17:06:24 dalibor Exp $
+# $Id: aclocal.m4,v 1.76 2003/12/09 12:37:26 dalibor Exp $
#
# Copyright (C) 2003 Free Software Foundation, Inc.
#
@@ -8767,7 +8767,7 @@
#
# GNU Crypto m4 macro for use by VM Providers
#
-# $Revision: 1.75 $
+# $Revision: 1.76 $
#
# process --with-gnu-crypto configure option.
Index: kaffe/config/Makefile.am
diff -u kaffe/config/Makefile.am:1.27 kaffe/config/Makefile.am:1.28
--- kaffe/config/Makefile.am:1.27 Sat Oct 4 18:52:52 2003
+++ kaffe/config/Makefile.am Tue Dec 9 12:37:27 2003
@@ -168,6 +168,7 @@
i386/win32/jit-md.h \
i386/win32/md.h \
i386/win32/win32-md.asm \
+ m68k/atomicity.h \
m68k/a-ux/config.frag \
m68k/a-ux/jit-md.h \
m68k/a-ux/md.c \
Index: kaffe/config/Makefile.in
diff -u kaffe/config/Makefile.in:1.94 kaffe/config/Makefile.in:1.95
--- kaffe/config/Makefile.in:1.94 Mon Dec 8 17:06:26 2003
+++ kaffe/config/Makefile.in Tue Dec 9 12:37:27 2003
@@ -410,6 +410,7 @@
i386/win32/jit-md.h \
i386/win32/md.h \
i386/win32/win32-md.asm \
+ m68k/atomicity.h \
m68k/a-ux/config.frag \
m68k/a-ux/jit-md.h \
m68k/a-ux/md.c \
===================================================================
Checking out kaffe/config/m68k/atomicity.h
RCS: /home/cvs/kaffe/kaffe/config/m68k/atomicity.h,v
VERS: 1.1
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/config/m68k/atomicity.h Tue Dec 9 12:40:24 2003
@@ -0,0 +1,39 @@
+/* Low-level functions for atomic operations. m680x0 version, x >= 2.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Taken from glibc-2.3.2, from sysdeps/m68k/m68020/atomicity.h */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+static inline int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ char ret;
+ long int readval;
+
+ __asm__ __volatile__ ("cas%.l %2,%3,%1; seq %0"
+ : "=dm" (ret), "=m" (*p), "=d" (readval)
+ : "d" (newval), "m" (*p), "2" (oldval));
+ return ret;
+}
+
+#endif /* atomicity.h */
Index: kaffe/config/m68k/common.h
diff -u kaffe/config/m68k/common.h:1.10 kaffe/config/m68k/common.h:1.11
--- kaffe/config/m68k/common.h:1.10 Sat Oct 4 23:34:57 2003
+++ kaffe/config/m68k/common.h Tue Dec 9 12:37:28 2003
@@ -5,6 +5,9 @@
* Copyright (c) 1996, 1997, 1998, 1999
* Transvirtual Technologies, Inc. All rights reserved.
*
+ * Copyright (c) 2003
+ * Kaffe.org contributors. See ChangeLog for details.
+ *
* See the file "license.terms" for information on usage and redistribution
* of this file.
*
@@ -21,6 +24,8 @@
#ifndef __m68k_common_h
#define __m68k_common_h
+#include "atomicity.h"
+
/*
* Alignment in structure is 2 bytes packed.
*/
@@ -38,121 +43,128 @@
*/
#if defined(__linux__) // try forcing linux sysdepCallMethod()
#ifdef USE_ASM /* Old and obsolete... */
-#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" \
-" cmp.b #0x46,%4 \n" \
-" bne 4f \n" \
-" fmove.s %/fp0,(%5) \n" \
-" jmp 6f \n" \
-" 4: \n" \
-" cmp.b #0x44,%4 \n" \
-" bne 5f \n" \
-" fmove.d %/fp0,(%5) \n" \
-" jmp 6f \n" \
-" 5: \n" \
-" move.l %/d0,(%5) \n" \
-" cmp.b #0x4a,%4 \n" \
-" bne 6f \n" \
-" move.l %/d1,4(%5) \n" \
-" 6: \n" \
-" " : \
- : "r" ((CALL)->nrargs), \
- "a" ((CALL)->args), \
- "a" ((CALL)->callsize), \
- "a" ((CALL)->function), \
- "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")
+static inline void sysdepCallMethod(callMethodInfo *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"
+ " cmp.b #0x46,%4 \n"
+ " bne 4f \n"
+ " fmove.s %/fp0,(%5) \n"
+ " jmp 6f \n"
+ " 4: \n"
+ " cmp.b #0x44,%4 \n"
+ " bne 5f \n"
+ " fmove.d %/fp0,(%5) \n"
+ " jmp 6f \n"
+ " 5: \n"
+ " move.l %/d0,(%5) \n"
+ " cmp.b #0x4a,%4 \n"
+ " bne 6f \n"
+ " move.l %/d1,4(%5) \n"
+ " 6: \n"
+ " " :
+ : "r" ((call)->nrargs),
+ "a" ((call)->args),
+ "a" ((call)->callsize),
+ "a" ((call)->function),
+ "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");
+}
+
#else /* undef USE_ASM */
// Linux version
-#define sysdepCallMethod(CALL) do { \
- int extraargs[(CALL)->nrargs]; \
- register int d0 asm ("d0"); \
- register int d1 asm ("d1"); \
- register double f0d asm ("fp0"); \
- register float f0f asm ("fp0"); \
- int *res; \
- int *args = extraargs; \
- int argidx; \
- for(argidx = 0; argidx < (CALL)->nrargs; ++argidx) { \
- if ((CALL)->callsize[argidx]) \
- *args++ = (CALL)->args[argidx].i; \
- else \
- *args++ = (CALL)->args[argidx-1].j; \
- } \
- asm volatile ("jsr %2@\n" \
- : "=r" (d0), "=r" (d1) \
- : "a" ((CALL)->function) \
- : "cc", "memory"); \
- if ((CALL)->retsize != 0) { \
- res = (int *)(CALL)->ret; \
- switch((CALL)->retsize) { \
- case 2: \
- if ((CALL)->rettype == 'D') \
- *(double*)res = f0d; \
- else { \
- res[1] = d1; \
- res[0] = d0; \
- } \
- break; \
- case 1: \
- if ((CALL)->rettype == 'F') \
- *(double*)res = f0f; \
- else \
- res[0] = d0; \
- break; \
- } \
- } \
-} while (0)
+static inline void sysdepCallMethod(callMethodInfo *call)
+{
+ int extraargs[(call)->nrargs];
+ register int d0 asm ("d0");
+ register int d1 asm ("d1");
+ register double f0d asm ("fp0");
+ register float f0f asm ("fp0");
+ int *res;
+ int *args = extraargs;
+ int argidx;
+ for(argidx = 0; argidx < (call)->nrargs; ++argidx) {
+ if ((call)->callsize[argidx])
+ *args++ = (call)->args[argidx].i;
+ else
+ *args++ = (call)->args[argidx-1].j;
+ }
+ asm volatile ("jsr %2@\n"
+ : "=r" (d0), "=r" (d1)
+ : "a" ((call)->function)
+ : "cc", "memory");
+ if ((call)->retsize != 0) {
+ res = (int *)(call)->ret;
+ switch((call)->retsize) {
+ case 2:
+ if ((call)->rettype == 'D')
+ *(double*)res = f0d;
+ else {
+ res[1] = d1;
+ res[0] = d0;
+ }
+ break;
+ case 1:
+ if ((call)->rettype == 'F')
+ *(double*)res = f0f;
+ else
+ res[0] = d0;
+ break;
+ }
+ }
+}
#endif /* USE_ASM */
#else /* not defined(__linux__) */
-#define sysdepCallMethod(CALL) do \
-{ \
- int extraargs[(CALL)->nrargs]; \
- register int d0 asm ("d0"); \
- register int d1 asm ("d1"); \
- register double f0d asm ("fp0"); \
- register float f0f asm ("fp0"); \
- int *res; \
- int *args = extraargs; \
- int argidx; \
- for(argidx = 0; argidx < (CALL)->nrargs; ++argidx) \
- { \
- if ((CALL)->callsize[argidx]) \
- *args++ = (CALL)->args[argidx].i; \
- else \
- *args++ = (CALL)->args[argidx-1].j; \
- } \
- asm volatile ("jsr %2@\n" \
- : "=r" (d0), "=r" (d1) \
- : "a" ((CALL)->function) \
- : "cc", "memory"); \
- if ((CALL)->retsize >= 1 ) \
- { \
- res = (int *)(CALL)->ret; \
- res[0] = d0; \
- if((CALL)->retsize > 1) /* >= 2 */ \
- res[1] = d1; \
- } \
-} while (0)
+static inline void sysdepCallMethod(callMethodInfo *call)
+{
+ int extraargs[(call)->nrargs];
+ register int d0 asm ("d0");
+ register int d1 asm ("d1");
+ register double f0d asm ("fp0");
+ register float f0f asm ("fp0");
+ int *res;
+ int *args = extraargs;
+ int argidx;
+ for(argidx = 0; argidx < (call)->nrargs; ++argidx)
+ {
+ if ((call)->callsize[argidx])
+ *args++ = (call)->args[argidx].i;
+ else
+ *args++ = (call)->args[argidx-1].j;
+ }
+ asm volatile ("jsr %2@\n"
+ : "=r" (d0), "=r" (d1)
+ : "a" ((call)->function)
+ : "cc", "memory");
+ if ((call)->retsize >= 1 )
+ {
+ res = (int *)(call)->ret;
+ res[0] = d0;
+ if((call)->retsize > 1) /* >= 2 */
+ res[1] = d1;
+ }
+}
#endif /* defined(__linux__) */
@@ -160,29 +172,9 @@
* 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.
- *
- * Modified by tony wyatt March 2003 - change register assignments
- * to force use of data registers in 'casl' instruction.
- * Also initialise return value by clearing at start.
*/
-#define COMPARE_AND_EXCHANGE(A,O,N) \
-({ \
- unsigned int tmp, ret = 0; \
- \
- asm volatile( \
- " clr %1 \n" \
- "1: movel %2, %0\n" \
- " cmpl %4, %0\n" \
- " bne 2f\n" \
- " casl %0, %5, %2\n" \
- " bne 1b\n" \
- " movq #1, %1\n" \
- "2:\n" \
- : "=&r" (tmp), "=&d" (ret), "=m" (*(A)) \
- : "m" (*(A)), "d" (O), "d" (N) \
- : "memory"); \
- \
- ret; \
-})
+
+
+#define COMPARE_AND_EXCHANGE(A, O, N) (compare_and_swap((long int*) A, (long int) O, (long int) N))
#endif