summaryrefslogtreecommitdiffstats
path: root/gcc/ggc.h
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2001-09-20 15:12:54 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2001-09-20 15:12:54 +0000
commit15d769aab42c4ea8a8863b8b37dee46c77155be0 (patch)
tree9f82325d87e923ce9de88e1e1f44c7643f7d9c53 /gcc/ggc.h
parent41f4d177c8884f82b1a6f3cf74af02cfd7e1c15c (diff)
downloadppe42-gcc-15d769aab42c4ea8a8863b8b37dee46c77155be0.tar.gz
ppe42-gcc-15d769aab42c4ea8a8863b8b37dee46c77155be0.zip
* fold-const.c (hashtab.h): Include.
(int_const_binop): Remove FORSIZE arg and compute from type; all callers changed. Call size_int_type_wide for all single-word constants. (size_htab_hash, size_htab_eq): New functions. (size_int_type_wide): Rework to use hash table. * ggc-common.c (hashtab.h): Include. (struct d_htab_root): New struct. (d_htab_roots): New variable. (ggc_add_deletable_htab, ggc_htab_delete): New functions (ggc_mark_roots): Handle deletable htabs. * ggc-page.c (ggc_marked_p): New function. * ggc-simple.c (ggc_marked_p): Likewise. * ggc.h: Reformatting throughout. (ggc_marked_p, ggc_add_deletable_htab): New declarations. * tree.c (init_obstacks): Make type_hash_table a deletable root. (type_hash_add): Allocate struct type_hash from GC memory. (mark_hash_entry, mark_type_hash): Deleted. (type_hash_marked_p, type_hash_mark): New functions. * Makefile.in (ggc-common.o, fold-const.o): Include hashtab.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45710 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc.h')
-rw-r--r--gcc/ggc.h88
1 files changed, 55 insertions, 33 deletions
diff --git a/gcc/ggc.h b/gcc/ggc.h
index be137e791b9..fe3290bc59a 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -47,23 +47,39 @@ extern const char digit_vector[]; /* "0" .. "9" */
extern varray_type ggc_pending_trees;
/* Manipulate global roots that are needed between calls to gc. */
-void ggc_add_root PARAMS ((void *base, int nelt, int size, void (*)(void *)));
-void ggc_add_rtx_root PARAMS ((struct rtx_def **, int nelt));
-void ggc_add_tree_root PARAMS ((union tree_node **, int nelt));
-void ggc_add_rtx_varray_root PARAMS ((struct varray_head_tag **, int nelt));
-void ggc_add_tree_varray_root PARAMS ((struct varray_head_tag **, int nelt));
-void ggc_add_tree_hash_table_root PARAMS ((struct hash_table **, int nelt));
-void ggc_del_root PARAMS ((void *base));
+extern void ggc_add_root PARAMS ((void *base, int nelt,
+ int size, void (*)(void *)));
+extern void ggc_add_rtx_root PARAMS ((struct rtx_def **, int nelt));
+extern void ggc_add_tree_root PARAMS ((union tree_node **,
+ int nelt));
+extern void ggc_add_rtx_varray_root PARAMS ((struct varray_head_tag **,
+ int nelt));
+extern void ggc_add_tree_varray_root PARAMS ((struct varray_head_tag **,
+ int nelt));
+extern void ggc_add_tree_hash_table_root PARAMS ((struct hash_table **,
+ int nelt));
+extern void ggc_del_root PARAMS ((void *base));
+
+/* Types used for mark test and marking functions, if specified, in call
+ below. */
+typedef int (*ggc_htab_marked_p) PARAMS ((const void *));
+typedef void (*ggc_htab_mark) PARAMS ((const void *));
+
+/* Add a hash table to be scanned when all roots have been processed. We
+ delete any entry in the table that has not been marked. The argument is
+ really htab_t. */
+extern void ggc_add_deletable_htab PARAMS ((PTR, ggc_htab_marked_p,
+ ggc_htab_mark));
/* Mark nodes from the gc_add_root callback. These functions follow
pointers to mark other objects too. */
-extern void ggc_mark_rtx_varray PARAMS ((struct varray_head_tag *));
-extern void ggc_mark_tree_varray PARAMS ((struct varray_head_tag *));
-extern void ggc_mark_tree_hash_table PARAMS ((struct hash_table *));
-extern void ggc_mark_roots PARAMS ((void));
+extern void ggc_mark_rtx_varray PARAMS ((struct varray_head_tag *));
+extern void ggc_mark_tree_varray PARAMS ((struct varray_head_tag *));
+extern void ggc_mark_tree_hash_table PARAMS ((struct hash_table *));
+extern void ggc_mark_roots PARAMS ((void));
-extern void ggc_mark_rtx_children PARAMS ((struct rtx_def *));
-extern void ggc_mark_rtvec_children PARAMS ((struct rtvec_def *));
+extern void ggc_mark_rtx_children PARAMS ((struct rtx_def *));
+extern void ggc_mark_rtvec_children PARAMS ((struct rtvec_def *));
/* If EXPR is not NULL and previously unmarked, mark it and evaluate
to true. Otherwise evaluate to false. */
@@ -108,23 +124,23 @@ extern void ggc_mark_rtvec_children PARAMS ((struct rtvec_def *));
/* A GC implementation must provide these functions. */
/* Initialize the garbage collector. */
-extern void init_ggc PARAMS ((void));
-extern void init_stringpool PARAMS ((void));
+extern void init_ggc PARAMS ((void));
+extern void init_stringpool PARAMS ((void));
/* Start a new GGC context. Memory allocated in previous contexts
will not be collected while the new context is active. */
-extern void ggc_push_context PARAMS ((void));
+extern void ggc_push_context PARAMS ((void));
/* Finish a GC context. Any uncollected memory in the new context
will be merged with the old context. */
-extern void ggc_pop_context PARAMS ((void));
+extern void ggc_pop_context PARAMS ((void));
/* Allocation. */
/* The internal primitive. */
-void *ggc_alloc PARAMS ((size_t));
+extern void *ggc_alloc PARAMS ((size_t));
/* Like ggc_alloc, but allocates cleared memory. */
-void *ggc_alloc_cleared PARAMS ((size_t));
+extern void *ggc_alloc_cleared PARAMS ((size_t));
#define ggc_alloc_rtx(NSLOTS) \
((struct rtx_def *) ggc_alloc (sizeof (struct rtx_def) \
@@ -139,27 +155,33 @@ void *ggc_alloc_cleared PARAMS ((size_t));
/* Allocate a gc-able string, and fill it with LENGTH bytes from CONTENTS.
If LENGTH is -1, then CONTENTS is assumed to be a
null-terminated string and the memory sized accordingly. */
-const char *ggc_alloc_string PARAMS ((const char *contents, int length));
+extern const char *ggc_alloc_string PARAMS ((const char *contents,
+ int length));
/* Make a copy of S, in GC-able memory. */
#define ggc_strdup(S) ggc_alloc_string((S), -1)
/* Invoke the collector. Garbage collection occurs only when this
function is called, not during allocations. */
-void ggc_collect PARAMS ((void));
+extern void ggc_collect PARAMS ((void));
/* Actually set the mark on a particular region of memory, but don't
follow pointers. This function is called by ggc_mark_*. It
returns zero if the object was not previously marked; non-zero if
the object was already marked, or if, for any other reason,
pointers in this data structure should not be traversed. */
-int ggc_set_mark PARAMS ((const void *));
+extern int ggc_set_mark PARAMS ((const void *));
+
+/* Return 1 if P has been marked, zero otherwise.
+ P must have been allocated by the GC allocator; it mustn't point to
+ static objects, stack variables, or memory allocated with malloc. */
+extern int ggc_marked_p PARAMS ((const void *));
/* Callbacks to the languages. */
/* This is the language's opportunity to mark nodes held through
the lang_specific hooks in the tree. */
-void lang_mark_tree PARAMS ((union tree_node *));
+extern void lang_mark_tree PARAMS ((union tree_node *));
/* The FALSE_LABEL_STACK, declared in except.h, has language-dependent
semantics. If a front-end needs to mark the false label stack, it
@@ -169,12 +191,12 @@ extern void (*lang_mark_false_label_stack) PARAMS ((struct label_node *));
/* Mark functions for various structs scattered about. */
-void mark_eh_status PARAMS ((struct eh_status *));
-void mark_emit_status PARAMS ((struct emit_status *));
-void mark_expr_status PARAMS ((struct expr_status *));
-void mark_stmt_status PARAMS ((struct stmt_status *));
-void mark_varasm_status PARAMS ((struct varasm_status *));
-void mark_optab PARAMS ((void *));
+void mark_eh_status PARAMS ((struct eh_status *));
+void mark_emit_status PARAMS ((struct emit_status *));
+void mark_expr_status PARAMS ((struct expr_status *));
+void mark_stmt_status PARAMS ((struct stmt_status *));
+void mark_varasm_status PARAMS ((struct varasm_status *));
+void mark_optab PARAMS ((void *));
/* Statistics. */
@@ -203,12 +225,12 @@ typedef struct ggc_statistics
} ggc_statistics;
/* Return the number of bytes allocated at the indicated address. */
-size_t ggc_get_size PARAMS ((const void *));
+extern size_t ggc_get_size PARAMS ((const void *));
/* Used by the various collectors to gather and print statistics that
do not depend on the collector in use. */
-void ggc_print_common_statistics PARAMS ((FILE *, ggc_statistics *));
+extern void ggc_print_common_statistics PARAMS ((FILE *, ggc_statistics *));
/* Print allocation statistics. */
-extern void ggc_print_statistics PARAMS ((void));
-void stringpool_statistics PARAMS ((void));
+extern void ggc_print_statistics PARAMS ((void));
+extern void stringpool_statistics PARAMS ((void));
OpenPOWER on IntegriCloud