From 565e3f3ec215eb47c30758a8944a6efce5d1fbb1 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 6 Sep 1999 02:10:03 +0000 Subject: [PATCH] Makefile.in (ggc-simple.o): Depend on hash.h. * 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. From-SVN: r29134 --- gcc/ChangeLog | 21 ++++++++++++++++++++- gcc/Makefile.in | 2 +- gcc/ggc-simple.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++- gcc/ggc.h | 4 ++++ gcc/profile.c | 1 - gcc/varray.h | 2 +- 6 files changed, 74 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 49349677dfd..430e62bc6cb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +Sun Sep 5 18:57:42 1999 Mark Mitchell + + * 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 + rtx, when defining fields. + +Sun Sep 5 18:57:42 1999 Bernd Schmidt + + * profile.c (output_func_start_profiler): Remove apparently + nonsensical call to start_sequence. + Sun Sep 5 17:34:33 1999 Richard Henderson * clipper/clipper.c (clipper_va_start): Fix typos. @@ -48,7 +67,7 @@ Sun Sep 5 00:35:17 1999 Richard Henderson (simplify_cond): Likewise. (simplify_text_exp): Likewise. (optimize_attrs): Likewise. - * gengentrtl.c (gendef): Use ggc_alloc_rtx to allocate RTL, when + * gengenrtl.c (gendef): Use ggc_alloc_rtx to allocate RTL, when GC'ing. (gencode): Generate a #include for ggc.h. * ggc-callbacks.c (ggc_p): Define it to zero. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index d60242e8a9a..5cb7a7ca2d8 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1433,7 +1433,7 @@ dumpvers: dumpvers.c version.o: version.c ggc-simple.o: ggc-simple.c $(CONFIG_H) $(RTL_BASE_H) $(TREE_H) flags.h \ - ggc.h varray.h + ggc.h varray.h hash.h ggc-none.o: ggc-none.c $(CONFIG_H) $(RTL_BASE_H) ggc.h 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)) diff --git a/gcc/ggc.h b/gcc/ggc.h index 557ee064d79..5acf3e9c7eb 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -37,6 +37,7 @@ struct emit_status; struct stmt_status; struct varasm_status; struct varray_head_tag; +struct hash_table; /* Startup */ @@ -60,12 +61,15 @@ void ggc_add_root PROTO ((void *base, int nelt, int size, void ggc_add_rtx_root PROTO ((struct rtx_def **, int nelt)); void ggc_add_tree_root PROTO ((union tree_node **, int nelt)); void ggc_add_tree_varray_root PROTO ((struct varray_head_tag **, int nelt)); +void ggc_add_tree_hash_table_root PROTO ((struct hash_table **, int nelt)); void ggc_del_root PROTO ((void *base)); /* Mark nodes from the gc_add_root callback. */ void ggc_mark_rtx PROTO ((struct rtx_def *)); void ggc_mark_rtvec PROTO ((struct rtvec_def *)); void ggc_mark_tree PROTO ((union tree_node *)); +void ggc_mark_tree_varray PROTO ((struct varray_head_tag *)); +void ggc_mark_tree_hash_table PROTO ((struct hash_table *)); void ggc_mark_string PROTO ((char *)); /* Callbacks to the languages. */ diff --git a/gcc/profile.c b/gcc/profile.c index 98be128a027..38ed7a72c40 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -1651,7 +1651,6 @@ output_func_start_profiler () /* Synthesize a constructor function to invoke __bb_init_func with a pointer to this object file's profile block. */ - start_sequence (); /* Try and make a unique name given the "file function name". diff --git a/gcc/varray.h b/gcc/varray.h index 5d773a39ed1..1b175eff0fa 100644 --- a/gcc/varray.h +++ b/gcc/varray.h @@ -47,7 +47,7 @@ struct const_equiv_data { pseudos that contain pointers into the replacement area allocated for this inline instance. These pseudos are then marked as being equivalent to the appropriate address and substituted if valid. */ - rtx rtx; + struct rtx_def *rtx; /* Record the valid age for each entry. The entry is invalid if its age is less than const_age. */ -- 2.30.2