aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2003-05-19 07:02:12 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2003-05-19 07:02:12 +0000
commit7e8f3096dc8d41f9bffec4033d42737a758d8e8d (patch)
tree5c9394428423772469ade05364ed58146be1036f /gcc/cp
parent1c745a02699797b52f1978dd00ac46b3b149938c (diff)
downloadgcc-7e8f3096dc8d41f9bffec4033d42737a758d8e8d.zip
gcc-7e8f3096dc8d41f9bffec4033d42737a758d8e8d.tar.gz
gcc-7e8f3096dc8d41f9bffec4033d42737a758d8e8d.tar.bz2
name-lookup.c (free_binding_entry): fix where the GTY markers are.
* name-lookup.c (free_binding_entry): fix where the GTY markers are. (binding_entry_make): Make entry->chain NULL after getting an entry. fix the spelling of chain in a comment. (binding_table_free): speed up by having temporary variable. (binding_table_new): set table->chain to be NULL after allocating a table. (cxx_binding_make): use gcc_alloc instead of ggc_alloc_cleared and set binding->previous to NULL after getting an binding for speed. From-SVN: r66948
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/name-lookup.c18
2 files changed, 23 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5226756..f2acb5c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,14 @@
+2003-05-18 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * name-lookup.c (free_binding_entry): fix where the GTY markers are.
+ (binding_entry_make): Make entry->chain NULL after getting an entry.
+ fix the spelling of chain in a comment.
+ (binding_table_free): speed up by having temporary variable.
+ (binding_table_new): set table->chain to be NULL after allocating
+ a table.
+ (cxx_binding_make): use gcc_alloc instead of ggc_alloc_cleared and set
+ binding->previous to NULL after getting an binding for speed.
+
2003-05-18 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cp-tree.h (struct lang_type_class): Replace data member tags
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index bead072..889d495 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -34,7 +34,7 @@ Boston, MA 02111-1307, USA. */
#define ENTRY_INDEX(HASH, COUNT) (((HASH) >> 3) & ((COUNT) - 1))
/* A free list of "binding_entry"s awaiting for re-use. */
-static binding_entry GTY((deletable(""))) free_binding_entry;
+static GTY((deletable(""))) binding_entry free_binding_entry = NULL;
/* Create a binding_entry object for (NAME, TYPE). */
static inline binding_entry
@@ -52,6 +52,7 @@ binding_entry_make (tree name, tree type)
entry->name = name;
entry->type = type;
+ entry->chain = NULL;
return entry;
}
@@ -72,7 +73,7 @@ struct binding_table_s GTY(())
binding_entry * GTY((length ("%h.chain_count"))) chain;
/* The number of chains in this table. This is the length of the
- the member "chaiin" considered as an array. */
+ the member "chain" considered as an array. */
size_t chain_count;
/* Number of "binding_entry"s in this table. */
@@ -99,12 +100,15 @@ binding_table_free (binding_table table)
for (i = 0; i < table->chain_count; ++i)
{
- while (table->chain[i] != NULL)
+ binding_entry temp = table->chain[i];
+ while (temp != NULL)
{
- binding_entry entry = table->chain[i];
- table->chain[i] = entry->chain;
+ binding_entry entry = temp;
+ temp = entry->chain;
+ entry->chain = NULL; // just be sure
binding_entry_free (entry);
}
+ table->chain[i] = temp;
}
table->entry_count = 0;
}
@@ -114,6 +118,7 @@ binding_table
binding_table_new (size_t chain_count)
{
binding_table table = ggc_alloc (sizeof (struct binding_table_s));
+ table->chain = NULL;
binding_table_construct (table, chain_count);
return table;
}
@@ -277,10 +282,11 @@ cxx_binding_make (tree value, tree type)
free_bindings = binding->previous;
}
else
- binding = ggc_alloc_cleared (sizeof (cxx_binding));
+ binding = ggc_alloc (sizeof (cxx_binding));
binding->value = value;
binding->type = type;
+ binding->previous = NULL;
return binding;
}