This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Committed, CRIS boehm-gc port
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Tue, 19 Apr 2005 18:07:15 +0200
- Subject: Committed, CRIS boehm-gc port
Committed after successfully running the single test on a
cris-axis-linux-gnu system with enough memory (256MeB). From
boehm-gc/tests/test.c it seems it requires 11000000 bytes free (or some
multiple thereof depending on debug macros which I didn't follow) for the
GC heap on 32-bit machines, without special compiler defines.
To avoid future import problems, I included a line from gc6.4 that seems
to have been left out when the M32R port was committed. No difference to
the master sources in these diffs, but I'd like to replace the m
constraint with Q in the test-and-set primitive (see the equivalent
construct in the libstdc++ sources).
2005-04-19 Hans-Peter Nilsson <hp@axis.com>
* os_dep.c, include/private/gc_locks.h: Import CRIS port by
Simon Posnjak from gc6.4.
* include/private/gcconfig.h: Ditto. Add M32R note from gc6.4.
Index: os_dep.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/os_dep.c,v
retrieving revision 1.31
diff -p -c -r1.31 os_dep.c
*** os_dep.c 17 Apr 2005 22:01:20 -0000 1.31
--- os_dep.c 19 Apr 2005 00:29:06 -0000
*************** SIG_PF GC_old_segv_handler; /* Also old
*** 2519,2525 ****
# if defined(ARM32)
char * addr = (char *)sc.fault_address;
# else
! --> architecture not supported
# endif
# endif
# endif
--- 2519,2529 ----
# if defined(ARM32)
char * addr = (char *)sc.fault_address;
# else
! # if defined(CRIS)
! char * addr = (char *)sc.regs.csraddr;
! # else
! --> architecture not supported
! # endif
# endif
# endif
# endif
Index: include/private/gc_locks.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/private/gc_locks.h,v
retrieving revision 1.9
diff -p -c -r1.9 gc_locks.h
*** include/private/gc_locks.h 28 Jul 2003 04:18:23 -0000 1.9
--- include/private/gc_locks.h 19 Apr 2005 00:29:06 -0000
***************
*** 215,220 ****
--- 215,244 ----
}
# define GC_TEST_AND_SET_DEFINED
# endif /* ARM32 */
+ # ifdef CRIS
+ inline static int GC_test_and_set(volatile unsigned int *addr) {
+ /* Ripped from linuxthreads/sysdeps/cris/pt-machine.h. */
+ /* Included with Hans-Peter Nilsson's permission. */
+ register unsigned long int ret;
+
+ /* Note the use of a dummy output of *addr to expose the write.
+ * The memory barrier is to stop *other* writes being moved past
+ * this code.
+ */
+ __asm__ __volatile__("clearf\n"
+ "0:\n\t"
+ "movu.b [%2],%0\n\t"
+ "ax\n\t"
+ "move.b %3,[%2]\n\t"
+ "bwf 0b\n\t"
+ "clearf"
+ : "=&r" (ret), "=m" (*addr)
+ : "r" (addr), "r" ((int) 1), "m" (*addr)
+ : "memory");
+ return ret;
+ }
+ # define GC_TEST_AND_SET_DEFINED
+ # endif /* CRIS */
# ifdef S390
inline static int GC_test_and_set(volatile unsigned int *addr) {
int ret;
Index: include/private/gcconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/private/gcconfig.h,v
retrieving revision 1.42
diff -p -c -r1.42 gcconfig.h
*** include/private/gcconfig.h 17 Apr 2005 22:01:21 -0000 1.42
--- include/private/gcconfig.h 19 Apr 2005 00:29:08 -0000
***************
*** 229,234 ****
--- 229,240 ----
# define ARM32
# define mach_type_known
# endif
+ # if defined(LINUX) && defined(__cris__)
+ # ifndef CRIS
+ # define CRIS
+ # endif
+ # define mach_type_known
+ # endif
# if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || defined(powerpc64) || defined(__powerpc64__))
# define POWERPC
# define mach_type_known
***************
*** 476,481 ****
--- 482,489 ----
/* POWERPC ==> IBM/Apple PowerPC */
/* (MACOS(<=9),DARWIN(incl.MACOSX),*/
/* LINUX, NETBSD, NOSYS variants) */
+ /* CRIS ==> Axis Etrax */
+ /* M32R ==> Renesas M32R */
/*
***************
*** 1801,1806 ****
--- 1809,1827 ----
# endif
#endif
+ # ifdef CRIS
+ # define MACH_TYPE "CRIS"
+ # define CPP_WORDSZ 32
+ # define ALIGNMENT 1
+ # define OS_TYPE "LINUX"
+ # define DYNAMIC_LOADING
+ # define LINUX_STACKBOTTOM
+ # define USE_GENERIC_PUSH_REGS
+ # define SEARCH_FOR_DATA_START
+ extern int _end[];
+ # define DATAEND (_end)
+ # endif
+
# ifdef SH
# define MACH_TYPE "SH"
# define ALIGNMENT 4
***************
*** 2066,2072 ****
# endif
# if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(DARWIN) \
! || defined(LINT) || defined(MSWINCE) || defined(ARM32) \
|| (defined(I386) && defined(__LCC__))
/* Use setjmp based hack to mark from callee-save registers. */
/* The define should move to the individual platform */
--- 2087,2093 ----
# endif
# if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(DARWIN) \
! || defined(LINT) || defined(MSWINCE) || defined(ARM32) || defined(CRIS) \
|| (defined(I386) && defined(__LCC__))
/* Use setjmp based hack to mark from callee-save registers. */
/* The define should move to the individual platform */
brgds, H-P