aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
authorAlex Samuel <samuel@codesourcery.com>1999-09-16 12:27:01 -0700
committerRichard Henderson <rth@gcc.gnu.org>1999-09-16 12:27:01 -0700
commit96df4529dc098109a5616d81feedade2f7b3922f (patch)
treea90b0ac22fb144d290710b57483c4c68cf242b07 /gcc/ggc-common.c
parent2a6ec461e1904dc900350bc530768308cd339c8e (diff)
downloadgcc-96df4529dc098109a5616d81feedade2f7b3922f.zip
gcc-96df4529dc098109a5616d81feedade2f7b3922f.tar.gz
gcc-96df4529dc098109a5616d81feedade2f7b3922f.tar.bz2
ggc.h (ggc_root): Move to ggc-common.c.
Thu Sep 16 11:50:52 1999 Alex Samuel <samuel@codesourcery.com> * ggc.h (ggc_root): Move to ggc-common.c. (roots): Remove. (ggc_mark_rtx, ggc_mark_tree): Change to macro. (ggc_mark_rtvec, ggc_mark_tree_varray): Declare extern. (ggc_mark_tree_hash_table, ggc_mark_string, ggc_mark): Likewise. (ggc_mark_roots, ggc_mark_rtx_children, ggc_mark_tree_children): New. * ggc-common.c (ggc_root): Move from ggc.h. (roots): Declare, static. (ggc_mark_rtx, ggc_mark_tree): Renamed to... (ggc_mark_rtx_children, ggc_mark_tree_children): Don't check for null or check/set mark bit. (ggc_mark_roots): New. * ggc-simple.c (ggc_collect): Call ggc_mark_roots. From-SVN: r29461
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r--gcc/ggc-common.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 30725a2..319623b 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -32,7 +32,18 @@
/* Maintain global roots that are preserved during GC. */
-struct ggc_root *roots;
+/* 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 *));
+};
+
+static struct ggc_root *roots;
/* Type-correct function to pass to ggc_add_root. It just forwards
*ELT (which is an rtx) to ggc_mark_tree_varray. */
@@ -170,15 +181,29 @@ ggc_del_root (base)
}
void
-ggc_mark_rtx (r)
+ggc_mark_roots ()
+{
+ struct ggc_root* x;
+
+ for (x = roots; x != NULL; x = x->next)
+ {
+ char *elt = x->base;
+ int s = x->size, n = x->nelt;
+ void (*cb) PROTO ((void *)) = x->cb;
+ int i;
+
+ for (i = 0; i < n; ++i, elt += s)
+ (*cb)(elt);
+ }
+}
+
+void
+ggc_mark_rtx_children (r)
rtx r;
{
const char *fmt;
int i;
- if (r == NULL_RTX || ggc_set_mark_rtx (r))
- return;
-
/* ??? If (some of) these are really pass-dependant info, do we have
any right poking our noses in? */
switch (GET_CODE (r))
@@ -256,13 +281,9 @@ ggc_mark_rtvec (v)
}
void
-ggc_mark_tree (t)
+ggc_mark_tree_children (t)
tree t;
{
- /* FIXME what if t == NULL_TREE ? */
- if (t == NULL || ggc_set_mark_tree (t))
- return;
-
/* Bits from common. */
ggc_mark_tree (TREE_TYPE (t));
ggc_mark_tree (TREE_CHAIN (t));