mirror of git://gcc.gnu.org/git/gcc.git
lto.c (gimple_canonical_types): Move out-of GC space.
2013-10-14 Richard Biener <rguenther@suse.de> lto/ * lto.c (gimple_canonical_types): Move out-of GC space. (canonical_type_hash_cache): Make a pointer-map. (num_canonical_type_hash_entries, num_canonical_type_hash_queries): New counters. (iterative_hash_canonical_type): Adjust. (read_cgraph_and_symbols): Likewise. (print_lto_report_1): Likewise. From-SVN: r203566
This commit is contained in:
parent
23e0b03aa6
commit
1394237ec9
|
|
@ -1,3 +1,13 @@
|
||||||
|
2013-10-14 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
* lto.c (gimple_canonical_types): Move out-of GC space.
|
||||||
|
(canonical_type_hash_cache): Make a pointer-map.
|
||||||
|
(num_canonical_type_hash_entries, num_canonical_type_hash_queries):
|
||||||
|
New counters.
|
||||||
|
(iterative_hash_canonical_type): Adjust.
|
||||||
|
(read_cgraph_and_symbols): Likewise.
|
||||||
|
(print_lto_report_1): Likewise.
|
||||||
|
|
||||||
2013-10-14 Richard Biener <rguenther@suse.de>
|
2013-10-14 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
* lto.c (gimple_types, type_hash_cache, struct type_pair_d,
|
* lto.c (gimple_types, type_hash_cache, struct type_pair_d,
|
||||||
|
|
|
||||||
|
|
@ -255,10 +255,10 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data,
|
||||||
|
|
||||||
|
|
||||||
/* Global canonical type table. */
|
/* Global canonical type table. */
|
||||||
static GTY((if_marked ("ggc_marked_p"), param_is (union tree_node)))
|
static htab_t gimple_canonical_types;
|
||||||
htab_t gimple_canonical_types;
|
static pointer_map <hashval_t> *canonical_type_hash_cache;
|
||||||
static GTY((if_marked ("tree_int_map_marked_p"), param_is (struct tree_int_map)))
|
static unsigned long num_canonical_type_hash_entries;
|
||||||
htab_t canonical_type_hash_cache;
|
static unsigned long num_canonical_type_hash_queries;
|
||||||
|
|
||||||
/* Returning a hash value for gimple type TYPE combined with VAL.
|
/* Returning a hash value for gimple type TYPE combined with VAL.
|
||||||
|
|
||||||
|
|
@ -269,12 +269,12 @@ static hashval_t
|
||||||
iterative_hash_canonical_type (tree type, hashval_t val)
|
iterative_hash_canonical_type (tree type, hashval_t val)
|
||||||
{
|
{
|
||||||
hashval_t v;
|
hashval_t v;
|
||||||
void **slot;
|
hashval_t *slot;
|
||||||
struct tree_int_map *mp, m;
|
|
||||||
|
|
||||||
m.base.from = type;
|
num_canonical_type_hash_queries++;
|
||||||
if ((slot = htab_find_slot (canonical_type_hash_cache, &m, NO_INSERT)))
|
slot = canonical_type_hash_cache->contains (type);
|
||||||
return iterative_hash_hashval_t (((struct tree_int_map *) *slot)->to, val);
|
if (slot)
|
||||||
|
return iterative_hash_hashval_t (*slot, val);
|
||||||
|
|
||||||
/* Combine a few common features of types so that types are grouped into
|
/* Combine a few common features of types so that types are grouped into
|
||||||
smaller sets; when searching for existing matching types to merge,
|
smaller sets; when searching for existing matching types to merge,
|
||||||
|
|
@ -374,14 +374,9 @@ iterative_hash_canonical_type (tree type, hashval_t val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cache the just computed hash value. */
|
/* Cache the just computed hash value. */
|
||||||
mp = ggc_alloc_cleared_tree_int_map ();
|
num_canonical_type_hash_entries++;
|
||||||
mp->base.from = type;
|
slot = canonical_type_hash_cache->insert (type);
|
||||||
mp->to = v;
|
*slot = v;
|
||||||
/* As we recurse the hashtable may expand between looking up the
|
|
||||||
cached value (and not finding one) and here, so we have to
|
|
||||||
re-lookup the slot. */
|
|
||||||
slot = htab_find_slot (canonical_type_hash_cache, &m, INSERT);
|
|
||||||
*slot = (void *) mp;
|
|
||||||
|
|
||||||
return iterative_hash_hashval_t (v, val);
|
return iterative_hash_hashval_t (v, val);
|
||||||
}
|
}
|
||||||
|
|
@ -2749,8 +2744,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
|
||||||
}
|
}
|
||||||
cgraph_state = CGRAPH_LTO_STREAMING;
|
cgraph_state = CGRAPH_LTO_STREAMING;
|
||||||
|
|
||||||
canonical_type_hash_cache = htab_create_ggc (512, tree_int_map_hash,
|
canonical_type_hash_cache = new pointer_map <hashval_t>;
|
||||||
tree_int_map_eq, NULL);
|
|
||||||
gimple_canonical_types = htab_create_ggc (16381, gimple_canonical_type_hash,
|
gimple_canonical_types = htab_create_ggc (16381, gimple_canonical_type_hash,
|
||||||
gimple_canonical_type_eq, 0);
|
gimple_canonical_type_eq, 0);
|
||||||
gcc_obstack_init (&tree_scc_hash_obstack);
|
gcc_obstack_init (&tree_scc_hash_obstack);
|
||||||
|
|
@ -2817,7 +2811,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
|
||||||
obstack_free (&tree_scc_hash_obstack, NULL);
|
obstack_free (&tree_scc_hash_obstack, NULL);
|
||||||
htab_delete (gimple_canonical_types);
|
htab_delete (gimple_canonical_types);
|
||||||
gimple_canonical_types = NULL;
|
gimple_canonical_types = NULL;
|
||||||
htab_delete (canonical_type_hash_cache);
|
delete canonical_type_hash_cache;
|
||||||
canonical_type_hash_cache = NULL;
|
canonical_type_hash_cache = NULL;
|
||||||
ggc_collect ();
|
ggc_collect ();
|
||||||
|
|
||||||
|
|
@ -3023,13 +3017,10 @@ print_lto_report_1 (void)
|
||||||
(long) gimple_canonical_types->searches,
|
(long) gimple_canonical_types->searches,
|
||||||
(long) gimple_canonical_types->collisions,
|
(long) gimple_canonical_types->collisions,
|
||||||
htab_collisions (gimple_canonical_types));
|
htab_collisions (gimple_canonical_types));
|
||||||
fprintf (stderr, "[%s] GIMPLE canonical type hash table: size %ld, "
|
fprintf (stderr, "[%s] GIMPLE canonical type pointer-map: "
|
||||||
"%ld elements, %ld searches, %ld collisions (ratio: %f)\n", pfx,
|
"%lu elements, %ld searches\n", pfx,
|
||||||
(long) htab_size (canonical_type_hash_cache),
|
num_canonical_type_hash_entries,
|
||||||
(long) htab_elements (canonical_type_hash_cache),
|
num_canonical_type_hash_queries);
|
||||||
(long) canonical_type_hash_cache->searches,
|
|
||||||
(long) canonical_type_hash_cache->collisions,
|
|
||||||
htab_collisions (canonical_type_hash_cache));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_lto_report (pfx);
|
print_lto_report (pfx);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue