diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-06 02:10:03 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-06 02:10:03 +0000 |
commit | 40a038bcc76abccc840d0e6564bd08abb62a59a2 (patch) | |
tree | 35321e13d117e53c293b79518646d2f25d786c3d /gcc/ggc-simple.c | |
parent | 276cdecebac7946640d9eabe21b213f5fc787500 (diff) | |
download | gcc-40a038bcc76abccc840d0e6564bd08abb62a59a2.tar.gz |
* Makefile.in (ggc-simple.o): Depend on hash.h.
* ggc.h (ggc_add_tree_hash_table_root): Declare.
(ggc_mark_tree_varray): Likewise.
(ggc_mark_tree_hash_table): Likewise.
* ggc-simple.c: Include hash.h.
(ggc_mark_tree_hash_table_ptr): New function.
(ggc_mark_tree_hash_table_entry): Likewise.
(ggc_mark_tree_hash_table): Likewise.
(ggc_add_tree_hash_table_root): Likewise.
* varray.h (const_equiv_data): Use struct rtx_def *, rather than
* profile.c (output_func_start_profiler): Remove apparently
nonsensical call to start_sequence.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29134 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-simple.c')
-rw-r--r-- | gcc/ggc-simple.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/gcc/ggc-simple.c b/gcc/ggc-simple.c index 0e7b53fc185..c9181a9f319 100644 --- a/gcc/ggc-simple.c +++ b/gcc/ggc-simple.c @@ -25,6 +25,7 @@ #include "ggc.h" #include "flags.h" #include "varray.h" +#include "hash.h" /* Debugging flags. */ #undef GGC_DUMP @@ -98,6 +99,9 @@ static void ggc_free_tree PROTO ((struct ggc_tree *t)); static void ggc_mark_rtx_ptr PROTO ((void *elt)); static void ggc_mark_tree_ptr PROTO ((void *elt)); static void ggc_mark_tree_varray_ptr PROTO ((void *elt)); +static void ggc_mark_tree_hash_table_ptr PROTO ((void *elt)); +static boolean ggc_mark_tree_hash_table_entry PROTO ((struct hash_entry *, + hash_table_key)); /* These allocators are dreadfully simple, with no caching whatsoever so that Purify-like tools that do allocation versioning can catch errors. @@ -486,6 +490,26 @@ ggc_mark_tree_varray (v) ggc_mark_tree (VARRAY_TREE (v, i)); } +/* Mark the hash table-entry HE. It's key field is really a tree. */ + +static boolean +ggc_mark_tree_hash_table_entry (he, k) + struct hash_entry *he; + hash_table_key k ATTRIBUTE_UNUSED; +{ + ggc_mark_tree ((tree) he->key); + return true; +} + +/* Mark all the elements of the hash-table H, which contains trees. */ + +void +ggc_mark_tree_hash_table (ht) + struct hash_table *ht; +{ + hash_traverse (ht, ggc_mark_tree_hash_table_entry, /*info=*/0); +} + void ggc_mark_string (s) char *s; @@ -659,7 +683,7 @@ ggc_add_tree_root (base, nelt) ggc_add_root (base, nelt, sizeof(tree), ggc_mark_tree_ptr); } -/* Add vV (a varray full of trees) to the list of GC roots. */ +/* Add V (a varray full of trees) to the list of GC roots. */ void ggc_add_tree_varray_root (base, nelt) @@ -670,6 +694,18 @@ ggc_add_tree_varray_root (base, nelt) ggc_mark_tree_varray_ptr); } +/* Add HT (a hash-table where ever key is a tree) to the list of GC + roots. */ + +void +ggc_add_tree_hash_table_root (base, nelt) + struct hash_table **base; + int nelt; +{ + ggc_add_root (base, nelt, sizeof (struct hash_table *), + ggc_mark_tree_hash_table_ptr); +} + void ggc_del_root (base) void *base; @@ -716,6 +752,17 @@ ggc_mark_tree_varray_ptr (elt) ggc_mark_tree_varray (*(varray_type *)elt); } +/* Type-correct function to pass to ggc_add_root. It just forwards + ELT (which is really a struct hash_table **) to + ggc_mark_tree_hash_table. */ + +static void +ggc_mark_tree_hash_table_ptr (elt) + void *elt; +{ + ggc_mark_tree_hash_table (*(struct hash_table **) elt); +} + #ifdef GGC_DUMP /* Don't enable this unless you want a really really lot of data. */ static void __attribute__((constructor)) |