summaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-20 15:26:56 +0000
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-20 15:26:56 +0000
commitc03efe256c6d8c877b8473859db9b41e3e645a19 (patch)
tree5cae300ef89647dadc0019c7c30a4ffb2eae6845 /gcc/ggc-common.c
parentb4a5e31d880ad7839f2b970970e865c7c9c8a430 (diff)
downloadgcc-c03efe256c6d8c877b8473859db9b41e3e645a19.tar.gz
* ggc-common.c (ggc_mark_root_tab): New function, split out from...
(ggc_mark_roots): ...here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163407 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r--gcc/ggc-common.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index cb1b64576a0..5b66bb4fa59 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -147,14 +147,25 @@ ggc_scan_cache_tab (const_ggc_cache_tab_t ctp)
}
}
+/* Mark all the roots in the table RT. */
+
+static void
+ggc_mark_root_tab (const_ggc_root_tab_t rt)
+{
+ size_t i;
+
+ for ( ; rt->base != NULL; rt++)
+ for (i = 0; i < rt->nelt; i++)
+ (*rt->cb) (*(void **) ((char *)rt->base + rt->stride * i));
+}
+
/* Iterate through all registered roots and mark each element. */
void
ggc_mark_roots (void)
{
const struct ggc_root_tab *const *rt;
- const struct ggc_root_tab *rti;
- const_ggc_root_tab_t rtp;
+ const_ggc_root_tab_t rtp, rti;
const struct ggc_cache_tab *const *ct;
const_ggc_cache_tab_t ctp;
size_t i;
@@ -164,16 +175,10 @@ ggc_mark_roots (void)
memset (rti->base, 0, rti->stride);
for (rt = gt_ggc_rtab; *rt; rt++)
- for (rti = *rt; rti->base != NULL; rti++)
- for (i = 0; i < rti->nelt; i++)
- (*rti->cb) (*(void **)((char *)rti->base + rti->stride * i));
+ ggc_mark_root_tab (*rt);
FOR_EACH_VEC_ELT (const_ggc_root_tab_t, extra_root_vec, i, rtp)
- {
- for (rti = rtp; rti->base != NULL; rti++)
- for (i = 0; i < rti->nelt; i++)
- (*rti->cb) (*(void **) ((char *)rti->base + rti->stride * i));
- }
+ ggc_mark_root_tab (rtp);
if (ggc_protect_identifiers)
ggc_mark_stringpool ();