summaryrefslogtreecommitdiff
path: root/sim/eventq.cc
diff options
context:
space:
mode:
authorAndrew Schultz <alschult@umich.edu>2003-10-31 17:32:04 -0500
committerAndrew Schultz <alschult@umich.edu>2003-10-31 17:32:04 -0500
commit2ab51fbcdb1d26d635875174eb23f60d6f9dc6bb (patch)
treea24dc79dca85e80ac7580a24a71299a939f07748 /sim/eventq.cc
parentb5fc3af142cfe71e6cb331dbed3b177193553a58 (diff)
downloadgem5-2ab51fbcdb1d26d635875174eb23f60d6f9dc6bb.tar.xz
Changed the naming of Serializeable derived objects. Serializeable no longer has
objName as a member, instead it has the pure virtual function name(). SimObject now has a objName member, and all classes derived directly from Serializeable have to implement a name() function (which now makes them unique by pointer value) cpu/simple_cpu/simple_cpu.cc: Change initialization of Event to get rid of Serializeable naming dev/etherlink.cc: dev/etherlink.hh: Seralizeable derived naming changes sim/eventq.cc: Serializeable derived naming changes, also changed serialization process so it doesn't need to use nameChildren sim/eventq.hh: Serializeable derived naming changes, remove constructor for specifying event name sim/serialize.cc: Serializeable derived naming changes, remove setName function and the child naming pass for serialization sim/serialize.hh: Serializeable derived naming changes, removed nameChildren, setName sim/sim_object.cc: sim/sim_object.hh: Serializeable derived naming changes --HG-- extra : convert_revision : 67bcc275b6c210f7049f98a1ad0d22e8f5596a63
Diffstat (limited to 'sim/eventq.cc')
-rw-r--r--sim/eventq.cc54
1 files changed, 26 insertions, 28 deletions
diff --git a/sim/eventq.cc b/sim/eventq.cc
index ef813eb13..eab499bd9 100644
--- a/sim/eventq.cc
+++ b/sim/eventq.cc
@@ -150,55 +150,53 @@ Event::unserialize(Checkpoint *cp, const string &section)
}
}
-
-void
-EventQueue::nameChildren()
-{
- int numEvents = 0;
- Event *event = head;
- while (event) {
- if (event->getFlags(Event::AutoSerialize)) {
- event->setName(csprintf("%s.event%d", name(), numEvents++));
- }
- event = event->next;
- }
-
- numAutoSerializeEvents = numEvents;
-}
-
void
EventQueue::serialize(ostream &os)
{
- // should have been set by a preceding call to nameChildren()
- assert(numAutoSerializeEvents >= 0);
-
- SERIALIZE_SCALAR(numAutoSerializeEvents);
+ std::list<Event *> eventPtrs;
int numEvents = 0;
Event *event = head;
while (event) {
if (event->getFlags(Event::AutoSerialize)) {
- event->nameOut(os);
- event->serialize(os);
+ eventPtrs.push_back(event);
numEvents++;
}
event = event->next;
}
- assert(numEvents == numAutoSerializeEvents);
-}
+ SERIALIZE_SCALAR(numEvents);
+ int i = 0;
+ for (std::list<Event *>::iterator it=eventPtrs.begin();
+ it != eventPtrs.end(); ++it) {
+ paramOut(os, csprintf("%s.eventPtr%d", name(), i++), (uintptr_t)*it);
+ }
+
+ for (std::list<Event *>::iterator it=eventPtrs.begin();
+ it != eventPtrs.end(); ++it) {
+ (*it)->nameOut(os);
+ (*it)->serialize(os);
+ }
+}
void
EventQueue::unserialize(Checkpoint *cp, const std::string &section)
{
- UNSERIALIZE_SCALAR(numAutoSerializeEvents);
- for (int eventNum = 0; eventNum < numAutoSerializeEvents; ++eventNum) {
- Serializeable::create(cp, csprintf("%s.event%d", section, eventNum));
+ int numEvents;
+ uintptr_t ptr;
+
+ UNSERIALIZE_SCALAR(numEvents);
+
+ for (int i = 0; i < numEvents; i++) {
+ // get the pointer value associated with the event
+ paramIn(cp, section, csprintf("%s.eventPtr%d", name(), i), ptr);
+
+ // create the event based on its pointer value
+ Serializeable::create(cp, csprintf("%s_%x", Event::defaultName, ptr));
}
}
-
void
EventQueue::dump()
{