aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-09-05 09:21:30 -0700
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-09-05 16:21:30 +0000
commitfc6af6e322072f2cbf63d79ae32050db3b08deab (patch)
tree5f0c5f13fe467ac17975e0c40cdce38e1e3be420
parenta3770a813002ceaedfe097ea46c8ddc09b9c289c (diff)
downloadgcc-fc6af6e322072f2cbf63d79ae32050db3b08deab.zip
gcc-fc6af6e322072f2cbf63d79ae32050db3b08deab.tar.gz
gcc-fc6af6e322072f2cbf63d79ae32050db3b08deab.tar.bz2
Makefile.in (parse.o): Depend on ggc.h.
* Makefile.in (parse.o): Depend on ggc.h. (decl2.o): Depend on ggc.h. (init.o): Depend on ggc.h. * cp-tree.h (init_decl2): Declare. (cp_parse_init): Likewise. * decl.c (ggc_p): Define to zero. (mark_saved_scope): New function. (init_decl_processing): Call cp_parse_init, and cp_decl2. Register GC roots. (expand_static_init): Add GC roots. * decl2.c: Include ggc.h. (init_decl2): New function. * init.c: Include ggc.h. (init_init_processing): Add GC roots. * parse.y: Include ggc.h. (cp_parse_init): New function. Co-Authored-By: Bernd Schmidt <bernds@cygnus.co.uk> Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r29126
-rw-r--r--gcc/cp/ChangeLog21
-rw-r--r--gcc/cp/Makefile.in7
-rw-r--r--gcc/cp/cp-tree.h4
-rw-r--r--gcc/cp/decl.c80
-rw-r--r--gcc/cp/decl2.c10
-rw-r--r--gcc/cp/init.c5
-rw-r--r--gcc/cp/parse.y10
7 files changed, 134 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5dedc9c..3bb762b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,24 @@
+1999-09-05 Richard Henderson <rth@cygnus.com>
+ Bernd Schmidt <bernds@cygnus.co.uk>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (parse.o): Depend on ggc.h.
+ (decl2.o): Depend on ggc.h.
+ (init.o): Depend on ggc.h.
+ * cp-tree.h (init_decl2): Declare.
+ (cp_parse_init): Likewise.
+ * decl.c (ggc_p): Define to zero.
+ (mark_saved_scope): New function.
+ (init_decl_processing): Call cp_parse_init, and cp_decl2.
+ Register GC roots.
+ (expand_static_init): Add GC roots.
+ * decl2.c: Include ggc.h.
+ (init_decl2): New function.
+ * init.c: Include ggc.h.
+ (init_init_processing): Add GC roots.
+ * parse.y: Include ggc.h.
+ (cp_parse_init): New function.
+
1999-09-04 Mark Mitchell <mark@codesourcery.com>
* decl.c (init_decl_processing): Set mark_lang_status.
diff --git a/gcc/cp/Makefile.in b/gcc/cp/Makefile.in
index d71938f..c01bd5e 100644
--- a/gcc/cp/Makefile.in
+++ b/gcc/cp/Makefile.in
@@ -209,7 +209,7 @@ EXPR_H = $(srcdir)/../expr.h ../insn-codes.h
parse.o : $(PARSE_C) $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h \
$(srcdir)/../except.h $(srcdir)/../output.h $(srcdir)/../system.h \
- $(srcdir)/../toplev.h
+ $(srcdir)/../toplev.h $(srcdir)/../ggc.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
`echo $(PARSE_C) | sed 's,^\./,,'`
@@ -250,7 +250,8 @@ decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
lex.h decl.h $(EXPR_H) $(srcdir)/../except.h \
$(srcdir)/../output.h $(srcdir)/../except.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../dwarf2out.h $(srcdir)/../dwarfout.h \
- $(srcdir)/../../include/splay-tree.h $(srcdir)/../varray.h
+ $(srcdir)/../../include/splay-tree.h $(srcdir)/../varray.h \
+ $(srcdir)/../ggc.h
typeck2.o : typeck2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
typeck.o : typeck.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
@@ -263,7 +264,7 @@ call.o : call.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
friend.o : friend.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
$(srcdir)/../system.h $(srcdir)/../toplev.h
init.o : init.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
- $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
+ $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h $(srcdir)/../ggc.h
method.o : method.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h
cvt.o : cvt.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h decl.h \
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 6d4cd85..cdb93e3 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3101,6 +3101,7 @@ extern tree create_implicit_typedef PROTO((tree, tree));
extern tree maybe_push_decl PROTO((tree));
/* in decl2.c */
+extern void init_decl2 PROTO((void));
extern int check_java_method PROTO((tree));
extern int lang_decode_option PROTO((int, char **));
extern tree grok_method_quals PROTO((tree, tree, tree));
@@ -3161,6 +3162,9 @@ extern tree handle_class_head PROTO((tree, tree, tree));
extern tree lookup_arg_dependent PROTO((tree, tree, tree));
extern void finish_static_data_member_decl PROTO((tree, tree, tree, int, int));
+/* in parse.y */
+extern void cp_parse_init PROTO((void));
+
/* in errfn.c */
/* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */
extern void cp_error PVPROTO((const char *, ...));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4fc9f8b..5f5e72f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -60,6 +60,10 @@ extern tree global_namespace;
extern int (*valid_lang_attribute) PROTO ((tree, tree, tree, tree));
+/* Don't use garbage collection. */
+
+int ggc_p = 0;
+
/* Obstack used for remembering local class declarations (like
enums and static (const) members. */
#include "stack.h"
@@ -2002,6 +2006,8 @@ wrapup_globals_for_namespace (namespace, data)
}
+/* Mark ARG (which is really a struct binding_level **) for GC. */
+
static void
mark_binding_level (arg)
void *arg;
@@ -2447,6 +2453,36 @@ struct saved_scope {
};
static struct saved_scope *current_saved_scope;
+/* Mark ARG (which is really a struct saved_scoipe **) for GC. */
+
+static void
+mark_saved_scope (arg)
+ void *arg;
+{
+ struct saved_scope *t = *(struct saved_scope **)arg;
+ while (t)
+ {
+ mark_binding_level (&t->old_binding_level);
+ mark_binding_level (&t->class_bindings);
+ ggc_mark_tree (t->old_bindings);
+ ggc_mark_tree (t->old_namespace);
+ ggc_mark_tree (t->class_name);
+ ggc_mark_tree (t->class_type);
+ ggc_mark_tree (t->access_specifier);
+ ggc_mark_tree (t->function_decl);
+ if (t->lang_base)
+ ggc_mark_tree (*t->lang_base);
+ if (t->lang_stack)
+ ggc_mark_tree (*t->lang_stack);
+ ggc_mark_tree (t->lang_name);
+ ggc_mark_tree (t->last_function_parms);
+ ggc_mark_tree (t->template_parms);
+ ggc_mark_tree (t->previous_class_type);
+ ggc_mark_tree (t->previous_class_values);
+ t = t->prev;
+ }
+}
+
/* A chain of the binding vecs created by store_bindings. We create a
whole bunch of these during compilation, on permanent_obstack, so we
can't just throw them away. */
@@ -6207,6 +6243,9 @@ init_decl_processing ()
restore_lang_status = &pop_cp_function_context;
mark_lang_status = &mark_cp_function_context;
+ cp_parse_init ();
+ init_decl2 ();
+
/* Create the global per-function variables. */
push_function_context_to (NULL_TREE);
@@ -6660,6 +6699,44 @@ init_decl_processing ()
say -fwritable-strings? */
if (flag_writable_strings)
flag_const_strings = 0;
+
+ /* Add GC roots for all of our global variables. */
+ ggc_add_tree_root (c_global_trees, sizeof c_global_trees / sizeof(tree));
+ ggc_add_tree_root (cp_global_trees, sizeof cp_global_trees / sizeof(tree));
+ ggc_add_tree_root (&char_type_node, 1);
+ ggc_add_tree_root (&current_function_decl, 1);
+ ggc_add_tree_root (&error_mark_node, 1);
+ ggc_add_tree_root (&integer_type_node, 1);
+ ggc_add_tree_root (&integer_three_node, 1);
+ ggc_add_tree_root (&integer_two_node, 1);
+ ggc_add_tree_root (&integer_one_node, 1);
+ ggc_add_tree_root (&integer_zero_node, 1);
+ ggc_add_tree_root (&signed_size_zero_node, 1);
+ ggc_add_tree_root (&named_labels, 1);
+ ggc_add_tree_root (&null_pointer_node, 1);
+ ggc_add_tree_root (&size_one_node, 1);
+ ggc_add_tree_root (&size_zero_node, 1);
+ ggc_add_tree_root (&unsigned_type_node, 1);
+ ggc_add_tree_root (&void_type_node, 1);
+ ggc_add_root (&global_binding_level, 1, sizeof global_binding_level,
+ mark_binding_level);
+ ggc_add_root (&current_saved_scope, 1, sizeof current_saved_scope,
+ &mark_saved_scope);
+ ggc_add_tree_root (&static_ctors, 1);
+ ggc_add_tree_root (&static_dtors, 1);
+
+ ggc_add_tree_root (&enum_next_value, 1);
+ ggc_add_tree_root (&last_function_parms, 1);
+ ggc_add_tree_root (&last_function_parm_tags, 1);
+ ggc_add_tree_root (&current_function_return_value, 1);
+ ggc_add_tree_root (&current_function_parms, 1);
+ ggc_add_tree_root (&current_function_parm_tags, 1);
+ ggc_add_tree_root (&error_mark_list, 1);
+ ggc_add_tree_root (&void_list_node, 1);
+ ggc_add_tree_root (&global_namespace, 1);
+ ggc_add_tree_root (&current_namespace, 1);
+ ggc_add_tree_root (&global_type_node, 1);
+ ggc_add_tree_root (&anonymous_namespace_name, 1);
}
/* Function to print any language-specific context for an error message. */
@@ -8252,6 +8329,9 @@ expand_static_init (decl, init)
if (Atexit == 0)
{
tree atexit_fndecl, PFV, pfvlist;
+
+ ggc_add_tree_root (&Atexit, 1);
+
/* Remember this information until end of file. */
push_obstacks (&permanent_obstack, &permanent_obstack);
PFV = build_pointer_type (build_function_type
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 8e6ae60..76cebf8 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -44,6 +44,7 @@ Boston, MA 02111-1307, USA. */
#include "dwarfout.h"
#include "splay-tree.h"
#include "varray.h"
+#include "ggc.h"
#if USE_CPPLIB
#include "cpplib.h"
@@ -5267,3 +5268,12 @@ handle_class_head (aggr, scope, id)
return decl;
}
+
+/* Initialize decl2.c. */
+
+void
+init_decl2 ()
+{
+ ggc_add_tree_root (&decl_namespace_list, 1);
+ ggc_add_tree_varray_root (&saved_inlines, 1);
+}
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 33a82cc..e2e082b 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */
#include "except.h"
#include "expr.h"
#include "toplev.h"
+#include "ggc.h"
static void expand_aggr_vbase_init_1 PROTO((tree, tree, tree, tree));
static void construct_virtual_bases PROTO((tree, tree, tree, tree, tree));
@@ -73,6 +74,10 @@ void init_init_processing ()
finish_builtin_type (BI_header_type, "__new_cookie", fields,
0, double_type_node);
BI_header_size = size_in_bytes (BI_header_type);
+
+ ggc_add_tree_root (&current_base_init_list, 1);
+ ggc_add_tree_root (&current_member_init_list, 1);
+ ggc_add_tree_root (&minus_one, 1);
}
/* Subroutine of emit_base_init. For BINFO, initialize all the
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index de9c1f3..bed84ab 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -42,6 +42,7 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "except.h"
#include "toplev.h"
+#include "ggc.h"
/* Since parsers are distinct for each language, put the language string
definition here. (fnf) */
@@ -335,6 +336,15 @@ parse_decl(declarator, specs_attrs, attributes, initialized, decl)
attributes, prefix_attributes);
return sm;
}
+
+void
+cp_parse_init ()
+{
+ ggc_add_tree_root (&current_declspecs, 1);
+ ggc_add_tree_root (&prefix_attributes, 1);
+ ggc_add_tree_root (&current_aggr, 1);
+ ggc_add_tree_root (&current_enum_type, 1);
+}
%}
%%