diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-05 02:41:35 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-05 02:41:35 +0000 |
commit | a7b0c1703cd201fa6e07895ead90464198f170eb (patch) | |
tree | e5cebe68f9343bcd10b7be75a8d15ab8791ec212 /gcc/tree.c | |
parent | 10f946bf78e0c973a626f1dd04bf275cd3612bf5 (diff) | |
download | gcc-a7b0c1703cd201fa6e07895ead90464198f170eb.tar.gz |
* Makefile.in (tree.o): Depend on ggc.h.
(varasm.o): Likewise.
(function.o): Likewise.
(stmt.o): Likewise.
(except.o): Likewise.
(optabs.o): Likewise.
(emit-rtl.o): Likewise.
* emit-rtl.c: Include ggc.h.
(sequence_element_free_list): Remove, and all references.
(mark_sequence): New functions.
(mark_emit_state): New function.
* except.c: Include ggc.h.
(mark_eh_node, mark_eh_stack, mark_eh_queue): New functions.
(mark_tree_label_node): New functions.
(mark_eh_state): New function.
* function.c: Include ggc.h.
(mark_temp_slot, mark_function_chain): New functions.
(mark_function_state): New function.
(init_function_once): New function.
* function.h (init_function_once): New function.
* ggc-callbacks.c (lang_mark_false_label_stack): New function.
* ggc.h (label_node): Declare.
(eh_status, emit_status, stmt_status, varasm_status): Likewise.
(lang_mark_false_label_stack): New function.
(mark_temp_slot): Remove declaration.
(mark_function_chain): Likewise.
(mark_eh_state): Adjust prototype.
(mark_stmt_state, mark_emit_state, mark_varasm_state, mark_optab):
Likewise.
* optabs.c: Include ggc.h.
(mark_optab): New function.
(init_optabs): Add gc roots.
* stmt.c: Include ggc.h.
(mark_cond_nesting, mark_loop_nesting): New functions.
(mark_block_nesting, mark_case_nesting, mark_goto_fixup): Likewise.
(mark_stmt_state): New function.
* toplev.c (compile_file): Call init_function_once.
* tree.c: Include ggc.h.
(type_hash): Move declaration earlier in file.
(TYPE_HASH_SIZE, type_hash_table): Likewise.
(init_obstacks): Add gc roots.
(mark_type_hash): New function.
* varasm.c: Include ggc.h.
(mark_pool_constant): New function.
(mark_varasm_state): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29119 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index e280190fcd5..1d0f27377da 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */ #include "function.h" #include "obstack.h" #include "toplev.h" +#include "ggc.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free @@ -247,9 +248,30 @@ int (*lang_get_alias_set) PROTO((tree)); codes are made. */ #define TYPE_HASH(TYPE) ((unsigned long) (TYPE) & 0777777) +/* Each hash table slot is a bucket containing a chain + of these structures. */ + +struct type_hash +{ + struct type_hash *next; /* Next structure in the bucket. */ + int hashcode; /* Hash code of this type. */ + tree type; /* The type recorded here. */ +}; + +/* Now here is the hash table. When recording a type, it is added + to the slot whose index is the hash code mod the table size. + Note that the hash table is used for several kinds of types + (function types, array types and array index range types, for now). + While all these live in the same table, they are completely independent, + and the hash code is computed differently for each of these. */ + +#define TYPE_HASH_SIZE 59 +struct type_hash *type_hash_table[TYPE_HASH_SIZE]; + static void set_type_quals PROTO((tree, int)); static void append_random_chars PROTO((char *)); static void build_real_from_int_cst_1 PROTO((PTR)); +static void mark_type_hash PROTO ((void *)); void gcc_obstack_init (); @@ -284,6 +306,11 @@ init_obstacks () /* Init the hash table of identifiers. */ bzero ((char *) hash_table, sizeof hash_table); + + ggc_add_tree_root (hash_table, MAX_HASH_TABLE); + ggc_add_root (type_hash_table, TYPE_HASH_SIZE, + sizeof(struct type_hash *), + mark_type_hash); } void @@ -3587,26 +3614,6 @@ build_type_copy (type) /* Hashing of types so that we don't make duplicates. The entry point is `type_hash_canon'. */ -/* Each hash table slot is a bucket containing a chain - of these structures. */ - -struct type_hash -{ - struct type_hash *next; /* Next structure in the bucket. */ - int hashcode; /* Hash code of this type. */ - tree type; /* The type recorded here. */ -}; - -/* Now here is the hash table. When recording a type, it is added - to the slot whose index is the hash code mod the table size. - Note that the hash table is used for several kinds of types - (function types, array types and array index range types, for now). - While all these live in the same table, they are completely independent, - and the hash code is computed differently for each of these. */ - -#define TYPE_HASH_SIZE 59 -struct type_hash *type_hash_table[TYPE_HASH_SIZE]; - /* Compute a hash code for a list of types (chain of TREE_LIST nodes with types in the TREE_VALUE slots), by adding the hash codes of the individual types. */ @@ -3714,6 +3721,21 @@ type_hash_canon (hashcode, type) return type; } +/* Mark ARG (which is really a struct type_hash **) for GC. */ + +static void +mark_type_hash (arg) + void *arg; +{ + struct type_hash *t = *(struct type_hash **) arg; + + while (t) + { + ggc_mark_tree (t->type); + t = t->next; + } +} + /* Compute a hash code for a list of attributes (chain of TREE_LIST nodes with names in the TREE_PURPOSE slots and args in the TREE_VALUE slots), by adding the hash codes of the individual attributes. */ |