mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-21 05:00:23 +08:00
lto-streamer.c (lto_streamer_cache_insert_1, [...]): Use pointer map instead of hashtable.
* lto-streamer.c (lto_streamer_cache_insert_1, lto_streamer_cache_lookup, lto_streamer_cache_create, lto_streamer_cache_delete): Use pointer map instead of hashtable. * lto-streamer.h (lto_streamer_cache_d): Turn node_map into pointer_map. From-SVN: r173259
This commit is contained in:
parent
95c952c532
commit
c33406f5b1
@ -1,3 +1,10 @@
|
||||
2011-05-02 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* lto-streamer.c (lto_streamer_cache_insert_1,
|
||||
lto_streamer_cache_lookup, lto_streamer_cache_create,
|
||||
lto_streamer_cache_delete): Use pointer map instead of hashtable.
|
||||
* lto-streamer.h (lto_streamer_cache_d): Turn node_map into pointer_map.
|
||||
|
||||
2011-05-02 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* config/m68k/genopt.sh, config/m68k/m68k-isas.def,
|
||||
|
@ -348,26 +348,20 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
|
||||
bool insert_at_next_slot_p)
|
||||
{
|
||||
void **slot;
|
||||
struct tree_int_map d_entry, *entry;
|
||||
unsigned ix;
|
||||
bool existed_p;
|
||||
|
||||
gcc_assert (t);
|
||||
|
||||
d_entry.base.from = t;
|
||||
slot = htab_find_slot (cache->node_map, &d_entry, INSERT);
|
||||
if (*slot == NULL)
|
||||
slot = pointer_map_insert (cache->node_map, t);
|
||||
if (!*slot)
|
||||
{
|
||||
/* Determine the next slot to use in the cache. */
|
||||
if (insert_at_next_slot_p)
|
||||
ix = VEC_length (tree, cache->nodes);
|
||||
else
|
||||
ix = *ix_p;
|
||||
|
||||
entry = (struct tree_int_map *)pool_alloc (cache->node_map_entries);
|
||||
entry->base.from = t;
|
||||
entry->to = ix;
|
||||
*slot = entry;
|
||||
*slot = (void *)(size_t) (ix + 1);
|
||||
|
||||
lto_streamer_cache_add_to_node_array (cache, ix, t);
|
||||
|
||||
@ -376,8 +370,7 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = (struct tree_int_map *) *slot;
|
||||
ix = entry->to;
|
||||
ix = (size_t) *slot - 1;
|
||||
|
||||
if (!insert_at_next_slot_p && ix != *ix_p)
|
||||
{
|
||||
@ -442,14 +435,12 @@ lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t,
|
||||
unsigned *ix_p)
|
||||
{
|
||||
void **slot;
|
||||
struct tree_int_map d_slot;
|
||||
bool retval;
|
||||
unsigned ix;
|
||||
|
||||
gcc_assert (t);
|
||||
|
||||
d_slot.base.from = t;
|
||||
slot = htab_find_slot (cache->node_map, &d_slot, NO_INSERT);
|
||||
slot = pointer_map_contains (cache->node_map, t);
|
||||
if (slot == NULL)
|
||||
{
|
||||
retval = false;
|
||||
@ -458,7 +449,7 @@ lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t,
|
||||
else
|
||||
{
|
||||
retval = true;
|
||||
ix = ((struct tree_int_map *) *slot)->to;
|
||||
ix = (size_t) *slot - 1;
|
||||
}
|
||||
|
||||
if (ix_p)
|
||||
@ -608,11 +599,7 @@ lto_streamer_cache_create (void)
|
||||
|
||||
cache = XCNEW (struct lto_streamer_cache_d);
|
||||
|
||||
cache->node_map = htab_create (101, tree_int_map_hash, tree_int_map_eq, NULL);
|
||||
|
||||
cache->node_map_entries = create_alloc_pool ("node map",
|
||||
sizeof (struct tree_int_map),
|
||||
100);
|
||||
cache->node_map = pointer_map_create ();
|
||||
|
||||
/* Load all the well-known tree nodes that are always created by
|
||||
the compiler on startup. This prevents writing them out
|
||||
@ -636,8 +623,7 @@ lto_streamer_cache_delete (struct lto_streamer_cache_d *c)
|
||||
if (c == NULL)
|
||||
return;
|
||||
|
||||
htab_delete (c->node_map);
|
||||
free_alloc_pool (c->node_map_entries);
|
||||
pointer_map_destroy (c->node_map);
|
||||
VEC_free (tree, heap, c->nodes);
|
||||
free (c);
|
||||
}
|
||||
|
@ -346,10 +346,7 @@ typedef void (lto_free_section_data_f) (struct lto_file_decl_data *,
|
||||
struct lto_streamer_cache_d
|
||||
{
|
||||
/* The mapping between tree nodes and slots into the nodes array. */
|
||||
htab_t node_map;
|
||||
|
||||
/* Node map to store entries into. */
|
||||
alloc_pool node_map_entries;
|
||||
struct pointer_map_t *node_map;
|
||||
|
||||
/* The nodes pickled so far. */
|
||||
VEC(tree,heap) *nodes;
|
||||
|
Loading…
x
Reference in New Issue
Block a user