PATCH to select GC implementation
Alex Samuel
samuel@codesourcery.com
Wed Oct 6 20:57:00 GMT 1999
This patch selects a garbage collector implementation depending on
host capabilities. If mmap is available, the ggc-page is used,
otherwise ggc-simple. This selection may be overridden by defining
USE_GGC_SIMPLE or USE_GGC_PAGE.
Alex Samuel
CodeSourcery, LLC
Tue Oct 5 17:32:47 1999 Alex Samuel <samuel@codesourcery.com>
* Makefile.in (GGC): Use ggc.o.
(OBJS): Add ggc.o.
(ggc.o): New target.
(ggc-simple.o, ggc-page.o): Remove targets.
* system.h: Select GC implementation if it isn't yet.
* ggc.c: New file.
* ggc-simple.c: Don't include config.h, system.h, or ggc.h.
* ggc-page.c: Likewise.
* rtl.h (rtx_def): Conditionalize gc_mark on GC implementation.
Index: Makefile.in
===================================================================
RCS file: /cvs/egcs/egcs/gcc/Makefile.in,v
retrieving revision 1.317
diff -c -r1.317 Makefile.in
*** Makefile.in 1999/10/02 20:13:24 1.317
--- Makefile.in 1999/10/06 00:33:20
***************
*** 308,314 ****
OBSTACK=obstack.o
# The GC method to be used on this system.
! GGC=ggc-simple.o
# If a supplementary library is being used for the GC.
GGC_LIB=
--- 308,314 ----
OBSTACK=obstack.o
# The GC method to be used on this system.
! GGC=ggc.o
# If a supplementary library is being used for the GC.
GGC_LIB=
***************
*** 666,672 ****
insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o lcm.o \
profile.o insn-attrtab.o $(out_object_file) $(EXTRA_OBJS) convert.o \
mbchar.o dyn-string.o splay-tree.o graph.o sbitmap.o resource.o hash.o \
! lists.o ggc-common.o $(GGC)
# GEN files are listed separately, so they can be built before doing parallel
# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
--- 666,672 ----
insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o lcm.o \
profile.o insn-attrtab.o $(out_object_file) $(EXTRA_OBJS) convert.o \
mbchar.o dyn-string.o splay-tree.o graph.o sbitmap.o resource.o hash.o \
! lists.o ggc-common.o ggc.o
# GEN files are listed separately, so they can be built before doing parallel
# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
***************
*** 1430,1440 ****
ggc-common.o: ggc-common.c $(CONFIG_H) $(RTL_BASE_H) $(TREE_H) \
flags.h ggc.h varray.h hash.h
! ggc-simple.o: ggc-simple.c $(CONFIG_H) $(RTL_BASE_H) $(TREE_H) flags.h \
! ggc.h varray.h hash.h
!
! ggc-page.o: ggc-page.c $(CONFIG_H) $(RTL_BASE_H) $(TREE_H) flags.h \
! ggc.h varray.h hash.h
ggc-none.o: ggc-none.c $(CONFIG_H) $(RTL_BASE_H) ggc.h
--- 1430,1437 ----
ggc-common.o: ggc-common.c $(CONFIG_H) $(RTL_BASE_H) $(TREE_H) \
flags.h ggc.h varray.h hash.h
! ggc.o: ggc.c ggc-simple.c ggc-page.c \
! $(CONFIG_H) $(RTL_BASE_H) $(TREE_H) flags.h ggc.h varray.h hash.h
ggc-none.o: ggc-none.c $(CONFIG_H) $(RTL_BASE_H) ggc.h
Index: system.h
===================================================================
RCS file: /cvs/egcs/egcs/gcc/system.h,v
retrieving revision 1.52
diff -c -r1.52 system.h
*** system.h 1999/09/22 14:23:21 1.52
--- system.h 1999/10/06 00:41:34
***************
*** 525,530 ****
--- 525,539 ----
# endif
#endif /* ! HOST_PTR_PRINTF */
+ /* Select a garbage collector implementation. */
+ #if !defined(USE_GGC_PAGE) && !defined(USE_GGC_SIMPLE)
+ # ifdef HAVE_MMAP
+ # define USE_GGC_PAGE
+ # else
+ # define USE_GGC_SIMPLE
+ # endif
+ #endif
+
/* Get libiberty declarations. */
#include "libiberty.h"
*** /dev/null Tue May 5 13:32:27 1998
--- ggc.c Fri Oct 1 14:47:52 1999
***************
*** 0 ****
--- 1,32 ----
+ /* Selector for garbage collector implementation.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+
+ This file is part of GNU CC.
+
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU CC 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+ #include "config.h"
+ #include "system.h"
+ #include "ggc.h"
+
+ #if defined USE_GGC_PAGE
+ #include "ggc-page.c"
+ #elif defined USE_GGC_SIMPLE
+ #include "ggc-simple.c"
+ #elif defined USE_NO_GGC
+ #else
+ #error "No GC option specified."
+ #endif
Index: ggc-simple.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/ggc-simple.c,v
retrieving revision 1.21
diff -c -r1.21 ggc-simple.c
*** ggc-simple.c 1999/10/05 15:42:18 1.21
--- ggc-simple.c 1999/10/06 00:36:56
***************
*** 18,32 ****
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
- #include "config.h"
- #include "system.h"
#include "rtl.h"
#include "tree.h"
#include "tm_p.h"
#include "flags.h"
#include "varray.h"
#include "hash.h"
- #include "ggc.h"
/* Debugging flags. */
--- 18,29 ----
Index: ggc-page.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/ggc-page.c,v
retrieving revision 1.5
diff -c -r1.5 ggc-page.c
*** ggc-page.c 1999/10/05 15:42:18 1.5
--- ggc-page.c 1999/10/06 00:36:03
***************
*** 18,31 ****
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
- #include "config.h"
- #include "system.h"
#include "tree.h"
#include "rtl.h"
#include "tm_p.h"
#include "varray.h"
#include "flags.h"
- #include "ggc.h"
#include <sys/mman.h>
--- 18,28 ----
Index: rtl.h
===================================================================
RCS file: /cvs/egcs/egcs/gcc/rtl.h,v
retrieving revision 1.139
diff -c -r1.139 rtl.h
*** rtl.h 1999/09/28 06:28:33 1.139
--- rtl.h 1999/10/06 00:38:34
***************
*** 108,118 ****
#endif
#else
/* The kind of expression this is. */
enum rtx_code code : 15;
#endif
! /* Used by the garbage collector. */
unsigned gc_mark : 1;
/* The kind of value the expression has. */
#ifdef ONLY_INT_FIELDS
--- 108,124 ----
#endif
#else
/* The kind of expression this is. */
+ #ifdef USE_GGC_SIMPLE
enum rtx_code code : 15;
+ #else
+ enum rtx_code code : 16;
#endif
+ #endif
! #ifdef USE_GGC_SIMPLE
! /* Used by the simple garbage collector. */
unsigned gc_mark : 1;
+ #endif
/* The kind of value the expression has. */
#ifdef ONLY_INT_FIELDS
More information about the Gcc-patches
mailing list