aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@codesourcery.com>2005-03-13 18:09:55 +0000
committerDaniel Jacobowitz <dan@codesourcery.com>2005-03-13 18:09:55 +0000
commit3ffbc16ad23e0cbf7f3a5b0b9505a2feb030b131 (patch)
treee850ce1ca545eaad896454198fdeff35370ff00f /gcc/ggc-common.c
parent5eeaf8a1a1090c4c7fb45b0fbac8097e61acffee (diff)
* ggc-zone.c: Rewritten.
* alloc-pool.c (dump_alloc_pool_statistics): Don't print statistics if there are none. * configure.ac: Define GGC_ZONE for --with-gc=zone. * config.in: Regenerated. * configure: Regenerated. * gentype.c (write_types_process_field, write_func_for_structure): Pass new argument to gt_pch_note_object. * ggc-common.c (struct ptr_data): Add TYPE. (gt_pch_note_object): Take TYPE argument and save it. (call_count): Update call to ggc_pch_count_object. (call_alloc): Update call to ggc_pch_alloc_object. (gt_pch_save): Call ggc_pch_prepare_write after paddng the PCH file. * ggc-none.c (rtl_zone, garbage_zone, ggc_alloc_zone_stat): Delete. * ggc-page.c (rtl_zone, tree_zone, garbage_zone) (ggc_alloc_zone_stat): Delete. (ggc_pch_count_object, ggc_pch_alloc_object): Add TYPE argument. * ggc.h (gt_pch_note_object, ggc_pch_count_object) (ggc_pch_alloc_object): Update prototypes. (garbage_zone): Delete. (tree_zone, rtl_zone, ggc_alloc_zone_stat, ggc_alloc_zone): Move to GGC_ZONE conditional. Update. Change tree_zone and rtl_zone into pointers. (tree_id_zone): New variable. (ggc_alloc_cleared_zone): Remove unused. (ggc_alloc_zone): Define. (ggc_alloc_rtvec, ggc_alloc_tree): Update to use ggc_alloc_zone. * rtl.c (rtx_alloc_stat, shallow_copy_rtx_stat): Use ggc_alloc_zone_stat. * stringpool.c (gt_pch_n_S): Update call to gt_pch_note_object. * tree.c (copy_node_stat, make_tree_binfo_stat, make_tree_vec_stat) (tree_cons_stat, build1_stat): Update call to ggc_alloc_zone_stat. (make_node_stat): Likewise. Use tree_id_zone. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@96381 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r--gcc/ggc-common.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 4f4e68fc89f..7112f78071e 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -244,6 +244,7 @@ struct ptr_data
gt_handle_reorder reorder_fn;
size_t size;
void *new_addr;
+ enum gt_types_enum type;
};
#define POINTER_HASH(x) (hashval_t)((long)x >> 3)
@@ -252,7 +253,8 @@ struct ptr_data
int
gt_pch_note_object (void *obj, void *note_ptr_cookie,
- gt_note_pointers note_ptr_fn)
+ gt_note_pointers note_ptr_fn,
+ enum gt_types_enum type)
{
struct ptr_data **slot;
@@ -277,6 +279,7 @@ gt_pch_note_object (void *obj, void *note_ptr_cookie,
(*slot)->size = strlen (obj) + 1;
else
(*slot)->size = ggc_get_size (obj);
+ (*slot)->type = type;
return 1;
}
@@ -330,7 +333,9 @@ call_count (void **slot, void *state_p)
struct ptr_data *d = (struct ptr_data *)*slot;
struct traversal_state *state = (struct traversal_state *)state_p;
- ggc_pch_count_object (state->d, d->obj, d->size, d->note_ptr_fn == gt_pch_p_S);
+ ggc_pch_count_object (state->d, d->obj, d->size,
+ d->note_ptr_fn == gt_pch_p_S,
+ d->type);
state->count++;
return 1;
}
@@ -341,7 +346,9 @@ call_alloc (void **slot, void *state_p)
struct ptr_data *d = (struct ptr_data *)*slot;
struct traversal_state *state = (struct traversal_state *)state_p;
- d->new_addr = ggc_pch_alloc_object (state->d, d->obj, d->size, d->note_ptr_fn == gt_pch_p_S);
+ d->new_addr = ggc_pch_alloc_object (state->d, d->obj, d->size,
+ d->note_ptr_fn == gt_pch_p_S,
+ d->type);
state->ptrs[state->ptrs_i++] = d;
return 1;
}
@@ -476,8 +483,6 @@ gt_pch_save (FILE *f)
write_pch_globals (gt_ggc_rtab, &state);
write_pch_globals (gt_pch_cache_rtab, &state);
- ggc_pch_prepare_write (state.d, state.f);
-
/* Pad the PCH file so that the mmapped area starts on an allocation
granularity (usually page) boundary. */
{
@@ -496,6 +501,8 @@ gt_pch_save (FILE *f)
&& fseek (state.f, mmi.offset, SEEK_SET) != 0)
fatal_error ("can't write padding to PCH file: %m");
+ ggc_pch_prepare_write (state.d, state.f);
+
/* Actually write out the objects. */
for (i = 0; i < state.count; i++)
{