diff options
author | Richard Henderson <rth@redhat.com> | 2003-01-30 10:14:06 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2003-01-30 10:14:06 -0800 |
commit | 52895e1a46c720b4869414b60051d9b77793064a (patch) | |
tree | ffe622bf1cea9eb96a1c15e2ecd46e025053bd39 /gcc | |
parent | c35c7e526f1da3895f6a1eb33b8c68585fd6c27c (diff) | |
download | gcc-52895e1a46c720b4869414b60051d9b77793064a.zip gcc-52895e1a46c720b4869414b60051d9b77793064a.tar.gz gcc-52895e1a46c720b4869414b60051d9b77793064a.tar.bz2 |
ggc-page.c (G.context_depth_allocations): New.
* ggc-page.c (G.context_depth_allocations): New.
(G.context_depth_collections): New.
(alloc_page): Set G.context_depth_allocations.
(ggc_collect): Set G.context_depth_collections.
(ggc_push_context): Limit to HOST_BITS_PER_LONG contexts.
(ggc_pop_context): Early exit for no allocations or collections.
From-SVN: r62152
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ggc-page.c | 22 |
2 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6de454a..62d24dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2003-01-30 Richard Henderson <rth@redhat.com> + * ggc-page.c (G.context_depth_allocations): New. + (G.context_depth_collections): New. + (alloc_page): Set G.context_depth_allocations. + (ggc_collect): Set G.context_depth_collections. + (ggc_push_context): Limit to HOST_BITS_PER_LONG contexts. + (ggc_pop_context): Early exit for no allocations or collections. + +2003-01-30 Richard Henderson <rth@redhat.com> + * tree-inline.c (walk_tree): Streamline duplicate hash table lookup. 2003-01-30 Richard Earnshaw <rearnsha@arm.com> diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 4898f07..e0064e7 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -344,6 +344,12 @@ static struct globals /* Total amount of memory mapped. */ size_t bytes_mapped; + /* Bit N set if any allocations have been done at context depth N. */ + unsigned long context_depth_allocations; + + /* Bit N set if any collections have been done at context depth N. */ + unsigned long context_depth_collections; + /* The current depth in the context stack. */ unsigned short context_depth; @@ -743,6 +749,8 @@ alloc_page (order) entry->num_free_objects = num_objects; entry->next_bit_hint = 1; + G.context_depth_allocations |= (unsigned long)1 << G.context_depth; + #ifdef USING_MALLOC_PAGE_GROUPS entry->group = group; set_page_group_in_use (group, page); @@ -1221,7 +1229,7 @@ ggc_push_context () ++G.context_depth; /* Die on wrap. */ - if (G.context_depth == 0) + if (G.context_depth >= HOST_BITS_PER_LONG) abort (); } @@ -1269,9 +1277,18 @@ ggc_recalculate_in_use_p (p) void ggc_pop_context () { + unsigned long omask; unsigned order, depth; depth = --G.context_depth; + omask = (unsigned long)1 << (depth + 1); + + if (!((G.context_depth_allocations | G.context_depth_collections) & omask)) + return; + + G.context_depth_allocations |= (G.context_depth_allocations & omask) >> 1; + G.context_depth_allocations &= omask - 1; + G.context_depth_collections &= omask - 1; /* Any remaining pages in the popped context are lowered to the new current context; i.e. objects allocated in the popped context and @@ -1529,6 +1546,9 @@ ggc_collect () reuse in the interim. */ release_pages (); + /* Indicate that we've seen collections at this context depth. */ + G.context_depth_collections = ((unsigned long)1 << (G.context_depth + 1)) - 1; + clear_marks (); ggc_mark_roots (); |