o3: handle fetch with no active threads correctly.
authorSteve Reinhardt <steve.reinhardt@amd.com>
Thu, 16 Apr 2009 06:12:00 +0000 (23:12 -0700)
committerSteve Reinhardt <steve.reinhardt@amd.com>
Thu, 16 Apr 2009 06:12:00 +0000 (23:12 -0700)
This situation can arise now on the first fetch cycle after
the last active thread is halted.  It seems easy enough to
deal with when it happens rather than trying to avoid it.

src/cpu/o3/fetch_impl.hh

index fcee2daa626e2c4ef8754d85f05b9a53647deb10..c3be74234b6134a3357e1972d9aefd0ef0164dd3 100644 (file)
@@ -1326,7 +1326,10 @@ DefaultFetch<Impl>::getFetchingThread(FetchPriority &fetch_priority)
         }
     } else {
         std::list<unsigned>::iterator thread = activeThreads->begin();
-        assert(thread != activeThreads->end());
+        if (thread == activeThreads->end()) {
+            return -1;
+        }
+
         int tid = *thread;
 
         if (fetchStatus[tid] == Running ||