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/commit_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/commit_impl.hh')
-rw-r--r-- | src/cpu/o3/commit_impl.hh | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh index f400d757b..d8236f077 100644 --- a/src/cpu/o3/commit_impl.hh +++ b/src/cpu/o3/commit_impl.hh @@ -387,9 +387,12 @@ void DefaultCommit<Impl>::updateStatus() { // reset ROB changed variable - std::list<unsigned>::iterator threads = (*activeThreads).begin(); - while (threads != (*activeThreads).end()) { + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { unsigned tid = *threads++; + changedROBNumEntries[tid] = false; // Also check if any of the threads has a trap pending @@ -416,9 +419,10 @@ DefaultCommit<Impl>::setNextStatus() { int squashes = 0; - 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 (commitStatus[tid] == ROBSquashing) { @@ -439,9 +443,10 @@ template <class Impl> bool DefaultCommit<Impl>::changedROBEntries() { - 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 (changedROBNumEntries[tid]) { @@ -563,14 +568,15 @@ DefaultCommit<Impl>::tick() return; } - if ((*activeThreads).size() <= 0) + if (activeThreads->empty()) return; - std::list<unsigned>::iterator threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); // Check if any of the threads are done squashing. Change the // status if they are done. - while (threads != (*activeThreads).end()) { + while (threads != end) { unsigned tid = *threads++; if (commitStatus[tid] == ROBSquashing) { @@ -591,9 +597,9 @@ DefaultCommit<Impl>::tick() markCompletedInsts(); - threads = (*activeThreads).begin(); + threads = activeThreads->begin(); - while (threads != (*activeThreads).end()) { + while (threads != end) { unsigned tid = *threads++; if (!rob->isEmpty(tid) && rob->readHeadInst(tid)->readyToCommit()) { @@ -691,9 +697,10 @@ DefaultCommit<Impl>::commit() //////////////////////////////////// // Check for any possible squashes, handle them first //////////////////////////////////// - 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++; // Not sure which one takes priority. I think if we have @@ -812,9 +819,9 @@ DefaultCommit<Impl>::commit() } //Check for any activity - threads = (*activeThreads).begin(); + threads = activeThreads->begin(); - while (threads != (*activeThreads).end()) { + while (threads != end) { unsigned tid = *threads++; if (changedROBNumEntries[tid]) { @@ -1264,9 +1271,10 @@ template <class Impl> bool DefaultCommit<Impl>::robDoneSquashing() { - 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 (!rob->isDoneSquashing(tid)) @@ -1345,7 +1353,8 @@ DefaultCommit<Impl>::getCommittingThread() return -1; } } else { - int tid = (*activeThreads).front(); + assert(!activeThreads->empty()); + int tid = activeThreads->front(); if (commitStatus[tid] == Running || commitStatus[tid] == Idle || @@ -1392,9 +1401,10 @@ DefaultCommit<Impl>::oldestReady() unsigned oldest = 0; bool first = 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 (!rob->isEmpty(tid) && |