diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-03 14:27:02 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-03 14:27:02 +0000 |
commit | b1e946eac198eec915b3844c2d6db15e2b60ee4e (patch) | |
tree | 4b026a1f81d4c8c69be6f59244a2cbe97a3763e6 /gcc/tree-streamer.c | |
parent | 21630e602ae2009b711241ac38134cadf1cbe926 (diff) |
2014-04-03 Richard Biener <rguenther@suse.de>
* tree-streamer.h (struct streamer_tree_cache_d): Add next_idx
member.
(streamer_tree_cache_create): Adjust.
* tree-streamer.c (streamer_tree_cache_add_to_node_array): Adjust
to allow optional nodes array.
(streamer_tree_cache_insert_1): Use next_idx to assign idx.
(streamer_tree_cache_append): Likewise.
(streamer_tree_cache_create): Create nodes array optionally
as specified by parameter.
* lto-streamer-out.c (create_output_block): Avoid maintaining
the node array in the writer cache.
(DFS_write_tree): Remove assertion.
(produce_asm_for_decls): Free the out decl state hash table
early.
* lto-streamer-in.c (lto_data_in_create): Adjust for
streamer_tree_cache_create prototype change.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209059 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-streamer.c')
-rw-r--r-- | gcc/tree-streamer.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/gcc/tree-streamer.c b/gcc/tree-streamer.c index af9461e77106..517bf77f66ba 100644 --- a/gcc/tree-streamer.c +++ b/gcc/tree-streamer.c @@ -101,20 +101,19 @@ static void streamer_tree_cache_add_to_node_array (struct streamer_tree_cache_d *cache, unsigned ix, tree t, hashval_t hash) { - /* Make sure we're either replacing an old element or - appending consecutively. */ - gcc_assert (ix <= cache->nodes.length ()); - - if (ix == cache->nodes.length ()) + /* We're either replacing an old element or appending consecutively. */ + if (cache->nodes.exists ()) { - cache->nodes.safe_push (t); - if (cache->hashes.exists ()) - cache->hashes.safe_push (hash); + if (cache->nodes.length () == ix) + cache->nodes.safe_push (t); + else + cache->nodes[ix] = t; } - else + if (cache->hashes.exists ()) { - cache->nodes[ix] = t; - if (cache->hashes.exists ()) + if (cache->hashes.length () == ix) + cache->hashes.safe_push (hash); + else cache->hashes[ix] = hash; } } @@ -146,7 +145,7 @@ streamer_tree_cache_insert_1 (struct streamer_tree_cache_d *cache, { /* Determine the next slot to use in the cache. */ if (insert_at_next_slot_p) - ix = cache->nodes.length (); + ix = cache->next_idx++; else ix = *ix_p; *slot = ix; @@ -211,7 +210,7 @@ void streamer_tree_cache_append (struct streamer_tree_cache_d *cache, tree t, hashval_t hash) { - unsigned ix = cache->nodes.length (); + unsigned ix = cache->next_idx++; if (!cache->node_map) streamer_tree_cache_add_to_node_array (cache, ix, t, hash); else @@ -326,7 +325,7 @@ preload_common_nodes (struct streamer_tree_cache_d *cache) /* Create a cache of pickled nodes. */ struct streamer_tree_cache_d * -streamer_tree_cache_create (bool with_hashes, bool with_map) +streamer_tree_cache_create (bool with_hashes, bool with_map, bool with_vec) { struct streamer_tree_cache_d *cache; @@ -334,7 +333,9 @@ streamer_tree_cache_create (bool with_hashes, bool with_map) if (with_map) cache->node_map = new pointer_map<unsigned>; - cache->nodes.create (165); + cache->next_idx = 0; + if (with_vec) + cache->nodes.create (165); if (with_hashes) cache->hashes.create (165); |