summaryrefslogtreecommitdiff
path: root/gcc/ggc-page.c
diff options
context:
space:
mode:
authortbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-02 22:46:00 +0000
committertbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-02 22:46:00 +0000
commit8f359205089fa4570dd9db058aed35e391ceb357 (patch)
treecb4aa8d407cf40f28ef0fcd771f1109d53f44f3c /gcc/ggc-page.c
parentc4de79b608465ea31bd920224bd7fdff2deeaecf (diff)
downloadgcc-8f359205089fa4570dd9db058aed35e391ceb357.tar.gz
support ggc hash_map and hash_set
gcc/ChangeLog: * alloc-pool.c: Include coretypes.h. * cgraph.h, dbxout.c, dwarf2out.c, except.c, except.h, function.c, function.h, symtab.c, tree-cfg.c, tree-eh.c: Use hash_map and hash_set instead of htab. * ggc-page.c (in_gc): New variable. (ggc_free): Do nothing if a collection is taking place. (ggc_collect): Set in_gc appropriately. * ggc.h (gt_ggc_mx(const char *)): New function. (gt_pch_nx(const char *)): Likewise. (gt_ggc_mx(int)): Likewise. (gt_pch_nx(int)): Likewise. * hash-map.h (hash_map::hash_entry::ggc_mx): Likewise. (hash_map::hash_entry::pch_nx): Likewise. (hash_map::hash_entry::pch_nx_helper): Likewise. (hash_map::hash_map): Adjust. (hash_map::create_ggc): New function. (gt_ggc_mx): Likewise. (gt_pch_nx): Likewise. * hash-set.h (default_hashset_traits::ggc_mx): Likewise. (default_hashset_traits::pch_nx): Likewise. (hash_set::hash_entry::ggc_mx): Likewise. (hash_set::hash_entry::pch_nx): Likewise. (hash_set::hash_entry::pch_nx_helper): Likewise. (hash_set::hash_set): Adjust. (hash_set::create_ggc): New function. (hash_set::elements): Likewise. (gt_ggc_mx): Likewise. (gt_pch_nx): Likewise. * hash-table.h (hash_table::hash_table): Adjust. (hash_table::m_ggc): New member. (hash_table::~hash_table): Adjust. (hash_table::expand): Likewise. (hash_table::empty): Likewise. (gt_ggc_mx): New function. (hashtab_entry_note_pointers): Likewise. (gt_pch_nx): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214834 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-page.c')
-rw-r--r--gcc/ggc-page.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 393954089f8..2a9b2d9e7fa 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -500,6 +500,10 @@ static struct globals
} stats;
} G;
+/* True if a gc is currently taking place. */
+
+static bool in_gc = false;
+
/* The size in bytes required to maintain a bitmap for the objects
on a page-entry. */
#define BITMAP_SIZE(Num_objects) \
@@ -1574,6 +1578,9 @@ ggc_get_size (const void *p)
void
ggc_free (void *p)
{
+ if (in_gc)
+ return;
+
page_entry *pe = lookup_page_table_entry (p);
size_t order = pe->order;
size_t size = OBJECT_SIZE (order);
@@ -2139,7 +2146,6 @@ ggc_collect (void)
MAX (G.allocated_last_gc, (size_t)PARAM_VALUE (GGC_MIN_HEAPSIZE) * 1024);
float min_expand = allocated_last_gc * PARAM_VALUE (GGC_MIN_EXPAND) / 100;
-
if (G.allocated < allocated_last_gc + min_expand && !ggc_force_collect)
return;
@@ -2162,6 +2168,7 @@ ggc_collect (void)
invoke_plugin_callbacks (PLUGIN_GGC_START, NULL);
+ in_gc = true;
clear_marks ();
ggc_mark_roots ();
ggc_handle_finalizers ();
@@ -2173,6 +2180,7 @@ ggc_collect (void)
validate_free_objects ();
sweep_pages ();
+ in_gc = false;
G.allocated_last_gc = G.allocated;
invoke_plugin_callbacks (PLUGIN_GGC_END, NULL);