OSDN Git Service

* decl.c (pop_cp_function_context): Don't call free on a NULL
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 30 Oct 1999 23:32:55 +0000 (23:32 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 30 Oct 1999 23:32:55 +0000 (23:32 +0000)
pointer.
* semantics.c: Include ggc.h.
(expand_body): Do garbage-collection after processing a template
function.  Clear DECL_SAVED_TREE after generating RTL for a
function.
* Makefile.in (semantics.o): Depend on ggc.h.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30279 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/Makefile.in
gcc/cp/decl.c
gcc/cp/semantics.c

index cee60ef..f430d58 100644 (file)
@@ -1,3 +1,13 @@
+1999-10-30  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (pop_cp_function_context): Don't call free on a NULL
+       pointer.
+       * semantics.c: Include ggc.h.
+       (expand_body): Do garbage-collection after processing a template
+       function.  Clear DECL_SAVED_TREE after generating RTL for a
+       function.
+       * Makefile.in (semantics.o): Depend on ggc.h.
+       
 1999-10-29  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.h (make_typename_type): Change prototype.
index d731a58..398703b 100644 (file)
@@ -295,7 +295,7 @@ repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
   $(srcdir)/../toplev.h $(srcdir)/../ggc.h
 semantics.o: semantics.c $(CONFIG_H) $(CXX_TREE_H) lex.h \
   $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h \
-  $(srcdir)/../flags.h
+  $(srcdir)/../flags.h $(srcdir)/../ggc.h
 dump.o: dump.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h
 
 #\f
index 00b52e4..0f9b5ab 100644 (file)
@@ -14234,7 +14234,8 @@ static void
 pop_cp_function_context (f)
      struct function *f;
 {
-  free (f->language);
+  if (f->language)
+    free (f->language);
   f->language = 0;
 }
 
index d0a30ba..54dd7e1 100644 (file)
@@ -32,6 +32,7 @@
 #include "lex.h"
 #include "toplev.h"
 #include "flags.h"
+#include "ggc.h"
 
 /* There routines provide a modular interface to perform many parsing
    operations.  They may therefore be used during actual parsing, or
@@ -2509,7 +2510,14 @@ expand_body (fn)
       || (DECL_LANG_SPECIFIC (fn) 
          && DECL_TEMPLATE_INFO (fn)
          && uses_template_parms (DECL_TI_ARGS (fn))))
-    return;
+    {
+      /* Normally, collection only occurs in rest_of_compilation.  So,
+        if we don't collect here, we never collect junk generated
+        during the processing of templates until we hit a
+        non-template function.  */
+      ggc_collect ();
+      return;
+    }
 
   /* There's no reason to do any of the work here if we're only doing
      semantic analysis; this code just generates RTL.  */
@@ -2546,6 +2554,11 @@ expand_body (fn)
   /* Generate code for the function.  */
   finish_function (lineno, 0);
 
+  /* We don't need the body any more.  Allow it to be garbage
+     collected.  We can't do this if we're going to dump everything.  */
+  if (!flag_dump_translation_unit)
+    DECL_SAVED_TREE (fn) = NULL_TREE;
+
   /* And restore the current source position.  */
   lineno = saved_lineno;
   input_filename = saved_input_filename;