diff options
author | Nathan Binkert <binkertn@umich.edu> | 2006-12-20 22:20:11 -0800 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2006-12-20 22:20:11 -0800 |
commit | 9aecfb3e3bfe1b85db9468bad287f22a2eb9bd4e (patch) | |
tree | d4b2cbff99ca89ea77011552ab5e57b2435b1326 /src/cpu/o3/rob_impl.hh | |
parent | 4b3538b609cfcce0891ee5ef7d690646a6030166 (diff) | |
download | gem5-9aecfb3e3bfe1b85db9468bad287f22a2eb9bd4e.tar.xz |
don't use (*activeThreads).begin(), use activeThreads->blah().
Also don't call (*activeThreads).end() over and over. Just
call activeThreads->end() once and save the result.
Make sure we always check that there are elements in the list
before we grab the first one.
--HG--
extra : convert_revision : d769d8ed52da99532d57a9bbc93e92ddf22b7e58
Diffstat (limited to 'src/cpu/o3/rob_impl.hh')
-rw-r--r-- | src/cpu/o3/rob_impl.hh | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/cpu/o3/rob_impl.hh b/src/cpu/o3/rob_impl.hh index fab114a74..fde636754 100644 --- a/src/cpu/o3/rob_impl.hh +++ b/src/cpu/o3/rob_impl.hh @@ -155,16 +155,18 @@ void ROB<Impl>::resetEntries() { if (robPolicy != Dynamic || numThreads > 1) { - int active_threads = (*activeThreads).size(); + int active_threads = activeThreads->size(); - std::list<unsigned>::iterator threads = (*activeThreads).begin(); - std::list<unsigned>::iterator list_end = (*activeThreads).end(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (threads != list_end) { if (robPolicy == Partitioned) { - maxEntries[*threads++] = numEntries / active_threads; + maxEntries[tid] = numEntries / active_threads; } else if (robPolicy == Threshold && active_threads == 1) { - maxEntries[*threads++] = numEntries; + maxEntries[tid] = numEntries; } } } @@ -318,9 +320,10 @@ bool ROB<Impl>::canCommit() { //@todo: set ActiveThreads through ROB or CPU - std::list<unsigned>::iterator threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); - while (threads != (*activeThreads).end()) { + while (threads != end) { unsigned tid = *threads++; if (isHeadReady(tid)) { @@ -432,22 +435,23 @@ ROB<Impl>::updateHead() bool first_valid = true; // @todo: set ActiveThreads through ROB or CPU - std::list<unsigned>::iterator threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); - while (threads != (*activeThreads).end()) { - unsigned thread_num = *threads++; + while (threads != end) { + unsigned tid = *threads++; - if (instList[thread_num].empty()) + if (instList[tid].empty()) continue; if (first_valid) { - head = instList[thread_num].begin(); + head = instList[tid].begin(); lowest_num = (*head)->seqNum; first_valid = false; continue; } - InstIt head_thread = instList[thread_num].begin(); + InstIt head_thread = instList[tid].begin(); DynInstPtr head_inst = (*head_thread); @@ -472,9 +476,10 @@ ROB<Impl>::updateTail() tail = instList[0].end(); bool first_valid = true; - std::list<unsigned>::iterator threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); - while (threads != (*activeThreads).end()) { + while (threads != end) { unsigned tid = *threads++; if (instList[tid].empty()) { |