decl.c (store_bindings): Use free_binding_vecs.
authorJason Merrill <jason@yorick.cygnus.com>
Thu, 19 Mar 1998 02:41:03 +0000 (02:41 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 19 Mar 1998 02:41:03 +0000 (21:41 -0500)
* decl.c (store_bindings): Use free_binding_vecs.
(pop_from_top_level): Likewise.

From-SVN: r18701

gcc/cp/ChangeLog
gcc/cp/decl.c

index b8269f39eb899f7e239147d48dcd023dfd8e64bf..5c45847a8b16fd2ae616fa78678a80d1a4d4bc4c 100644 (file)
@@ -1,3 +1,8 @@
+Thu Mar 19 02:27:48 1998  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (store_bindings): Use free_binding_vecs.
+       (pop_from_top_level): Likewise.
+
 Wed Mar 18 12:41:43 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
        * decl.c (make_implicit_typename): Only change the type of a 
index 80fc9592292367fe65a9505210180a1b5d011a53..09ad59ca170a65c868c96ea26383c4e84be29f3f 100644 (file)
@@ -1897,6 +1897,11 @@ struct saved_scope {
 };
 static struct saved_scope *current_saved_scope;
 
+/* 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.  */
+static tree free_binding_vecs;
+
 static tree
 store_bindings (names, old_bindings)
      tree names, old_bindings;
@@ -1919,8 +1924,15 @@ store_bindings (names, old_bindings)
       for (t1 = old_bindings; t1; t1 = TREE_CHAIN (t1))
        if (TREE_VEC_ELT (t1, 0) == id)
          goto skip_it;
-           
-      binding = make_tree_vec (4);
+
+      if (free_binding_vecs)
+       {
+         binding = free_binding_vecs;
+         free_binding_vecs = TREE_CHAIN (free_binding_vecs);
+       }
+      else
+       binding = make_tree_vec (4);
+
       if (id)
        {
          my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135);
@@ -2045,8 +2057,9 @@ pop_from_top_level ()
 
   current_binding_level = s->old_binding_level;
   current_saved_scope = s->prev;
-  for (t = s->old_bindings; t; t = TREE_CHAIN (t))
+  for (t = s->old_bindings; t; )
     {
+      tree save = t;
       tree id = TREE_VEC_ELT (t, 0);
       if (id)
        {
@@ -2054,6 +2067,9 @@ pop_from_top_level ()
          IDENTIFIER_LOCAL_VALUE (id) = TREE_VEC_ELT (t, 2);
          IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3);
        }
+      t = TREE_CHAIN (t);
+      TREE_CHAIN (save) = free_binding_vecs;
+      free_binding_vecs = save;
     }
   current_class_name = s->class_name;
   current_class_type = s->class_type;