From: Nathan Binkert Date: Sat, 21 Feb 2004 15:46:31 +0000 (-0500) Subject: Change order of serialization X-Git-Tag: m5_1.0_beta2~138 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e067bc751bd13d73dfb0abe31f296140e3e29de9;p=gem5.git Change order of serialization sim/sim_object.cc: serialize objects in the reverse order of their creation. This causes a SimObject that is dependent on another to be serialized first. For example, the ethernet device writes back some data to physical memory while serializing, so this will cause the physical memory to be serialized after that, preserving the data written back. --HG-- extra : convert_revision : f9a37b63ce777df1cfecefa80f94f8fc69e42448 --- diff --git a/sim/sim_object.cc b/sim/sim_object.cc index b3ac2c7a4..c55021e41 100644 --- a/sim/sim_object.cc +++ b/sim/sim_object.cc @@ -182,11 +182,11 @@ SimObject::printAllExtraOutput(ostream &os) void SimObject::serializeAll(ostream &os) { - SimObjectList::iterator i = simObjectList.begin(); - SimObjectList::iterator end = simObjectList.end(); + SimObjectList::reverse_iterator ri = simObjectList.rbegin(); + SimObjectList::reverse_iterator rend = simObjectList.rend(); - for (; i != end; ++i) { - SimObject *obj = *i; + for (; ri != rend; ++ri) { + SimObject *obj = *ri; obj->nameOut(os); obj->serialize(os); }