AtomicSimpleCPU: Refactor resume() code to have a cleaner control path.
authorAli Saidi <saidi@eecs.umich.edu>
Thu, 8 Nov 2007 15:46:41 +0000 (10:46 -0500)
committerAli Saidi <saidi@eecs.umich.edu>
Thu, 8 Nov 2007 15:46:41 +0000 (10:46 -0500)
--HG--
extra : convert_revision : f27bb96850e7fb0252fb1f47c3d0860705c32884

src/cpu/simple/atomic.cc

index 4e52f9b335a4991d89c2b2e41ff779f12d117328..9d7181cea8dbb6fe11cf965b9f96d1a52c267488 100644 (file)
@@ -194,15 +194,16 @@ AtomicSimpleCPU::unserialize(Checkpoint *cp, const string &section)
 void
 AtomicSimpleCPU::resume()
 {
+    if (_status == Idle || _status == SwitchedOut)
+        return;
+
     DPRINTF(SimpleCPU, "Resume\n");
-    if (_status != SwitchedOut && _status != Idle) {
-        assert(system->getMemoryMode() == Enums::atomic);
+    assert(system->getMemoryMode() == Enums::atomic);
 
-        changeState(SimObject::Running);
-        if (thread->status() == ThreadContext::Active) {
-            if (!tickEvent.scheduled()) {
-                tickEvent.schedule(nextCycle());
-            }
+    changeState(SimObject::Running);
+    if (thread->status() == ThreadContext::Active) {
+        if (!tickEvent.scheduled()) {
+            tickEvent.schedule(nextCycle());
         }
     }
 }