diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-11 19:48:37 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-11 19:48:37 +0000 |
commit | bebb7b68450793785186ad9e432079dc03a8adca (patch) | |
tree | 25e4668ec01e4ed6581ac2e1bbd77e7e268b4b96 /gcc/ggc.h | |
parent | af9e3b100b083afd4ab619514f4c3ea9d0923a54 (diff) | |
download | gcc-bebb7b68450793785186ad9e432079dc03a8adca.tar.gz |
Alex Samuel <samuel@codesourcery.com>
* ggc.h (rtvec_def): Forward declare.
(tree_node): Likewise.
(ggc_root): Define.
(roots): Declare.
(ggc_set_mark_rtx): Add prototype.
(ggc_set_mark_rtvec): Likewise.
(ggc_set_mark_tree): Likewise.
* ggc-simple.c (ggc_root): Don't define.
(roots): Don't declare.
(ggc_mark_rtx): Remove.
(ggc_mark_rtvec): Likewise.
(ggc_mark_tree): Likewise.
(ggc_mark_varray): Likewise.
(ggc_mark_tree_hash_table_entry): Likewise.
(ggc_mark_tree_hash_table): Likewise.
(ggc_set_mart_rtx): New function.
(ggc_set_mark_rtvec): Likewise.
(ggc_set_mark_tree): Likewise.
(ggc_add_root): Remove.
(ggc_add_rtx_root): Likewise.
(ggc_remove_tree_root): Likewise.
(ggc_add_string_root): Likewise.
(ggc_add_tree_varray_root): Likewise.
(ggc_add_tree_hash_table_root): Likewise.
(ggc_del_root): Likewise.
(ggc_mark_rtx_ptr): Likewise.
(ggc_mark_tree_ptr): Likewise.
(ggc_mark_string_ptr): Likewise.
(ggc_mark_tree_varray_ptr): Likewise.
(ggc_mark_tree_hash_table_ptr): Likewise.
* ggc-common.c: New file.
* Makefile.in (OBJS): Add ggc-common.o.
(ggc-common.o): List dependencies.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29281 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc.h')
-rw-r--r-- | gcc/ggc.h | 69 |
1 files changed, 48 insertions, 21 deletions
diff --git a/gcc/ggc.h b/gcc/ggc.h index bd6fe2fe543..d7111d62e32 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -31,27 +31,63 @@ extern int ggc_p; compiler. However, rather than force everyone who includes this header to include all the headers in which they are declared, we just forward-declare them here. */ -struct label_node; struct eh_status; struct emit_status; +struct hash_table; +struct label_node; +struct rtvec_def; struct stmt_status; +union tree_node; struct varasm_status; struct varray_head_tag; -struct hash_table; -/* Startup */ +/* Global roots that are preserved during calls to gc. */ + +struct ggc_root +{ + struct ggc_root *next; + void *base; + int nelt; + int size; + void (*cb) PROTO ((void *)); +}; + +extern struct ggc_root *roots; + +/* Manipulate global roots that are needed between calls to gc. */ +void ggc_add_root PROTO ((void *base, int nelt, int size, void (*)(void *))); +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_string_root PROTO ((char **, 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. These functions follow + pointers to mark other objects too. */ +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 *)); +void ggc_mark PROTO ((void *)); + + +/* A GC implementation must provide these functions. */ + +/* Initialize the garbage collector. */ extern void init_ggc PROTO ((void)); /* Start a new GGC context. Memory allocated in previous contexts will not be collected while the new context is active. */ extern void ggc_pop_context PROTO ((void)); + /* Finish a GC context. Any uncollected memory in the new context will be merged with the old context. */ extern void ggc_push_context PROTO ((void)); /* Allocation. */ - struct rtx_def *ggc_alloc_rtx PROTO ((int nslots)); struct rtvec_def *ggc_alloc_rtvec PROTO ((int nelt)); union tree_node *ggc_alloc_tree PROTO ((int length)); @@ -60,26 +96,17 @@ void *ggc_alloc PROTO ((size_t)); /* Invoke the collector. This is really just a hint, but in the case of the simple collector, the only time it will happen. */ - void ggc_collect PROTO ((void)); -/* Manipulate global roots that are needed between calls to gc. */ -void ggc_add_root PROTO ((void *base, int nelt, int size, void (*)(void *))); -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_string_root PROTO ((char **, 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)); +/* Actually set the mark on a particular region of memory, but don't + follow pointers. These functions are called by ggc_mark_*. They + return zero if the object was not previously marked; they return + 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_rtx PROTO ((struct rtx_def *)); +int ggc_set_mark_rtvec PROTO ((struct rtvec_def *)); +int ggc_set_mark_tree PROTO ((union tree_node *)); -/* 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 *)); -void ggc_mark PROTO ((void *)); /* Callbacks to the languages. */ |