PATCH to select GC implementation

Richard Henderson rth@cygnus.com
Sun Oct 31 23:33:00 GMT 1999


On Wed, Oct 06, 1999 at 08:56:52PM -0700, Alex Samuel wrote:
> 	* Makefile.in (GGC): Use ggc.o.
> 	(OBJS): Add ggc.o.
> 	(ggc.o): New target.
> 	(ggc-simple.o, ggc-page.o): Remove targets.

This has several weak points in my view.  First, I really dislike
the .c including other .c style.

> 	* system.h: Select GC implementation if it isn't yet.

Second, there's no accompanying configure.in change to turn on 
HAVE_MMAP.  Did you notice ggc-page not being turned on?

> 	* rtl.h (rtx_def): Conditionalize gc_mark on GC implementation.

Third, although you didn't know this because I didn't mention
it to anyone, I'm considering eliminating some of the complexity
here, and treating everything as anonymous memory, and maintaining
the GC marks externally.

So these will go away for all collectors.

I've checked in the following to choose collectors.



r~


        * configure.in: Detect mmap.  Add --with-gc=foo to select
        garbage collector; default to page if mmap available.
        * Makefile.in (GGC): Substitute.

Index: configure.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/configure.in,v
retrieving revision 1.294
diff -u -p -d -r1.294 configure.in
--- configure.in	1999/09/27 20:02:43	1.294
+++ configure.in	1999/10/07 08:12:07
@@ -385,6 +385,7 @@ case "${host}" in
   ;;
 esac
 AC_FUNC_VFORK
+AC_FUNC_MMAP
 
 GCC_NEED_DECLARATIONS(bcopy bzero bcmp \
 	index rindex getenv atol sbrk abort atof strerror getcwd getwd \
@@ -4429,6 +4430,26 @@ if test $thread_file != single; then
     gthread_flags=-DHAVE_GTHR_DEFAULT
 fi
 AC_SUBST(gthread_flags)
+
+# Find out what GC implementation we want, or may, use.
+AC_ARG_WITH(gc,
+[  --with-gc={simple,page} Choose the garbage collection mechanism to use
+                           with the compiler.],
+[case "$withval" in
+  simple | page)
+    GGC=ggc-$withval
+    ;;
+  *)
+    AC_MSG_ERROR([$withval is an invalid option to --with-gc])
+    ;;
+esac],
+[if test $ac_cv_func_mmap_fixed_mapped = yes; then
+  GGC=ggc-page
+else
+  GGC=ggc-simple
+fi])
+AC_SUBST(GGC)
+echo "Using $GGC for garbage collection."
 
 # Make empty files to contain the specs and options for each language.
 # Then add #include lines to for a compiler that has specs and/or options.
Index: Makefile.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/Makefile.in,v
retrieving revision 1.317
diff -u -p -d -r1.317 Makefile.in
--- Makefile.in	1999/10/02 20:13:24	1.317
+++ Makefile.in	1999/10/07 08:12:08
@@ -308,7 +308,7 @@ CLIB=
 OBSTACK=obstack.o
 
 # The GC method to be used on this system.
-GGC=ggc-simple.o
+GGC=@GGC@.o
 
 # If a supplementary library is being used for the GC.
 GGC_LIB=



More information about the Gcc-patches mailing list