LSQ Unit: After deleting part of a split request, set it to NULL so that it
[gem5.git] / src / sim / eventq.cc
index d1f84fcb2d44fb0986901a4c30a7b78e1bca4bfa..d460610642ecaada059896f7535109052a9297db 100644 (file)
@@ -60,6 +60,7 @@ Counter Event::instanceCounter = 0;
 Event::~Event()
 {
     assert(!scheduled());
+    flags = 0;
 }
 
 const std::string
@@ -232,13 +233,22 @@ Event::unserialize(Checkpoint *cp, const string &section)
     UNSERIALIZE_SCALAR(_when);
     UNSERIALIZE_SCALAR(_priority);
 
-    // need to see if original event was in a scheduled, unsquashed
-    // state, but don't want to restore those flags in the current
-    // object itself (since they aren't immediately true)
     short _flags;
     UNSERIALIZE_SCALAR(_flags);
+
+    // Old checkpoints had no concept of the Initialized flag
+    // so restoring from old checkpoints always fail.
+    // Events are initialized on construction but original code 
+    // "flags = _flags" would just overwrite the initialization. 
+    // So, read in the checkpoint flags, but then set the Initialized 
+    // flag on top of it in order to avoid failures.
+    assert(initialized());
     flags = _flags;
+    flags.set(Initialized);
 
+    // need to see if original event was in a scheduled, unsquashed
+    // state, but don't want to restore those flags in the current
+    // object itself (since they aren't immediately true)
     bool wasScheduled = flags.isSet(Scheduled) && !flags.isSet(Squashed);
     flags.clear(Squashed | Scheduled);
 
@@ -407,3 +417,7 @@ Event::dump() const
         cprintf("Not Scheduled\n");
     }
 }
+
+EventQueue::EventQueue(const string &n)
+    : objName(n), head(NULL)
+{}