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
This commit is contained in:
Richard Henderson 2003-01-30 10:14:06 -08:00 committed by Richard Henderson
parent c35c7e526f
commit 52895e1a46
2 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,12 @@
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.

View File

@ -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 ();