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
This commit is contained in:
@@ -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) &&
|
||||
|
||||
Reference in New Issue
Block a user