From 9aecfb3e3bfe1b85db9468bad287f22a2eb9bd4e Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 20 Dec 2006 22:20:11 -0800 Subject: 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 --- src/cpu/o3/fetch_impl.hh | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'src/cpu/o3/fetch_impl.hh') diff --git a/src/cpu/o3/fetch_impl.hh b/src/cpu/o3/fetch_impl.hh index 622259495..fe320fa79 100644 --- a/src/cpu/o3/fetch_impl.hh +++ b/src/cpu/o3/fetch_impl.hh @@ -756,10 +756,10 @@ typename DefaultFetch::FetchStatus DefaultFetch::updateFetchStatus() { //Check Running - std::list::iterator threads = (*activeThreads).begin(); - - while (threads != (*activeThreads).end()) { + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); + while (threads != end) { unsigned tid = *threads++; if (fetchStatus[tid] == Running || @@ -819,12 +819,13 @@ template void DefaultFetch::tick() { - std::list::iterator threads = (*activeThreads).begin(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); bool status_change = false; wroteToTimeBuffer = false; - while (threads != (*activeThreads).end()) { + while (threads != end) { unsigned tid = *threads++; // Check the signals for each thread to determine the proper status @@ -1363,7 +1364,9 @@ DefaultFetch::getFetchingThread(FetchPriority &fetch_priority) return -1; } } else { - int tid = *((*activeThreads).begin()); + std::list::iterator thread = activeThreads->begin(); + assert(thread != activeThreads->end()); + int tid = *thread; if (fetchStatus[tid] == Running || fetchStatus[tid] == IcacheAccessComplete || @@ -1413,9 +1416,10 @@ DefaultFetch::iqCount() { std::priority_queue PQ; - std::list::iterator threads = (*activeThreads).begin(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); - while (threads != (*activeThreads).end()) { + while (threads != end) { unsigned tid = *threads++; PQ.push(fromIEW->iewInfo[tid].iqCount); @@ -1443,10 +1447,10 @@ DefaultFetch::lsqCount() { std::priority_queue PQ; + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); - std::list::iterator threads = (*activeThreads).begin(); - - while (threads != (*activeThreads).end()) { + while (threads != end) { unsigned tid = *threads++; PQ.push(fromIEW->iewInfo[tid].ldstqCount); @@ -1472,7 +1476,10 @@ template int DefaultFetch::branchCount() { - std::list::iterator threads = (*activeThreads).begin(); + std::list::iterator thread = activeThreads->begin(); + assert(thread != activeThreads->end()); + unsigned tid = *thread; + panic("Branch Count Fetch policy unimplemented\n"); - return *threads; + return 0 * tid; } -- cgit v1.2.3