diff options
author | Ben Cheng <bccheng@google.com> | 2014-04-22 13:33:12 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-04-22 13:33:12 -0700 |
commit | e3cc64dec20832769406aa38cde83c7dd4194bf4 (patch) | |
tree | ef8e39be37cfe0cb69d850043b7924389ff17164 /gcc-4.9/gcc/tree-streamer.c | |
parent | f33c7b3122b1d7950efa88067c9a156229ba647b (diff) | |
download | toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.gz toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.bz2 toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.zip |
[4.9] GCC 4.9.0 official release refresh
Change-Id: Ic99a7da8b44b789a48aeec93b33e93944d6e6767
Diffstat (limited to 'gcc-4.9/gcc/tree-streamer.c')
-rw-r--r-- | gcc-4.9/gcc/tree-streamer.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/gcc-4.9/gcc/tree-streamer.c b/gcc-4.9/gcc/tree-streamer.c index af9461e77..517bf77f6 100644 --- a/gcc-4.9/gcc/tree-streamer.c +++ b/gcc-4.9/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); |