#include <cassert>
#include <iostream>
#include <string>
+#include <unordered_map>
#include <vector>
-#include "base/hashmap.hh"
#include "base/misc.hh"
#include "base/trace.hh"
#include "cpu/smt.hh"
event->process();
if (event->isExitEvent()) {
- assert(!event->flags.isSet(Event::AutoDelete) ||
+ assert(!event->flags.isSet(Event::Managed) ||
!event->flags.isSet(Event::IsMainQueue)); // would be silly
return event;
}
event->flags.clear(Event::Squashed);
}
- if (event->flags.isSet(Event::AutoDelete) && !event->scheduled())
- delete event;
+ event->release();
return NULL;
}
// 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
+ // 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;
}
}
-void
-EventQueue::serialize(CheckpointOut &cp) const
-{
- std::list<Event *> eventPtrs;
-
- int numEvents = 0;
- Event *nextBin = head;
- while (nextBin) {
- Event *nextInBin = nextBin;
-
- while (nextInBin) {
- if (nextInBin->flags.isSet(Event::AutoSerialize)) {
- eventPtrs.push_back(nextInBin);
- paramOut(cp, csprintf("event%d", numEvents++),
- nextInBin->name());
- }
- nextInBin = nextInBin->nextInBin;
- }
-
- nextBin = nextBin->nextBin;
- }
-
- SERIALIZE_SCALAR(numEvents);
-
- for (Event *ev : eventPtrs)
- ev->serializeSection(cp, ev->name());
-}
-
-void
-EventQueue::unserialize(CheckpointIn &cp)
-{
- int numEvents;
- UNSERIALIZE_SCALAR(numEvents);
-
- std::string eventName;
- for (int i = 0; i < numEvents; i++) {
- // get the pointer value associated with the event
- paramIn(cp, csprintf("event%d", i), eventName);
-
- // create the event based on its pointer value
- Serializable *obj(Serializable::create(cp, eventName));
- Event *event(dynamic_cast<Event *>(obj));
- fatal_if(!event,
- "Event queue unserialized something that wasn't an event.\n");
-
- checkpointReschedule(event);
- }
-}
-
void
EventQueue::checkpointReschedule(Event *event)
{
bool
EventQueue::debugVerify() const
{
- m5::hash_map<long, bool> map;
+ std::unordered_map<long, bool> map;
Tick time = 0;
short priority = 0;