dont check total # of threads but instead all
active threads
if (numActiveThreads() > 0)
return activeThreads.front();
else
- return -1;
+ return InvalidThreadID;
}
ThreadID
FirstStage::getFetchingThread(FetchPriority &fetch_priority)
{
- if (numThreads > 1) {
- switch (fetch_priority) {
+ ThreadID num_active_threads = cpu->numActiveThreads();
+ if (num_active_threads > 1) {
+ switch (fetch_priority) {
case SingleThread:
- return 0;
+ return cpu->activeThreadId();
case RoundRobin:
return roundRobin();
default:
return InvalidThreadID;
}
- } else {
+ } else if (num_active_threads == 1) {
ThreadID tid = *activeThreads->begin();
if (stageStatus[tid] == Running ||
} else {
return InvalidThreadID;
}
- }
-
+ } else {
+ return InvalidThreadID;
+ }
}
ThreadID