diff options
author | Rafael Ávila de Espíndola <rafael.espindola@gmail.com> | 2015-04-17 11:51:36 -0400 |
---|---|---|
committer | Rafael Ávila de Espíndola <rafael.espindola@gmail.com> | 2015-04-17 11:51:36 -0400 |
commit | 4277535cdc6ce6998cdc273bbe454f9ca2c23037 (patch) | |
tree | c5205ed53cb26c0b0b76a9e756b84ef48165d7a8 /gold/gc.cc | |
parent | a4ea36c6cb13d100aacab3a90762597cef471b35 (diff) | |
download | gdb-4277535cdc6ce6998cdc273bbe454f9ca2c23037.zip gdb-4277535cdc6ce6998cdc273bbe454f9ca2c23037.tar.gz gdb-4277535cdc6ce6998cdc273bbe454f9ca2c23037.tar.bz2 |
Use LIFO instead of FIFO to implement gc's transitive closure.
FIFO is harder to implement and has less locality than LIFO. It is
also not necessary to implement a transitive closure, a LIFO works
just as well.
Diffstat (limited to 'gold/gc.cc')
-rw-r--r-- | gold/gc.cc | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -38,8 +38,8 @@ Garbage_collection::do_transitive_closure() { // Add elements from the work list to the referenced list // one by one. - Section_id entry = this->worklist().front(); - this->worklist().pop(); + Section_id entry = this->worklist().back(); + this->worklist().pop_back(); if (!this->referenced_list().insert(entry).second) continue; Garbage_collection::Section_ref::iterator find_it = @@ -57,7 +57,7 @@ Garbage_collection::do_transitive_closure() if (this->referenced_list().find(*it_v) == this->referenced_list().end()) { - this->worklist().push(*it_v); + this->worklist().push_back(*it_v); } } } |