From: Ali Saidi Date: Fri, 12 May 2006 21:47:23 +0000 (-0400) Subject: fix the checkpoint bug X-Git-Tag: m5_2.0_beta1~87^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7929b9ee19b6fabc7e69b704fa07fdb6daa35c70;p=gem5.git fix the checkpoint bug --HG-- extra : convert_revision : 1ccae3282737d70b14ff86c8647e2e662a42c3bc --- diff --git a/dev/sinic.cc b/dev/sinic.cc index d19ef268f..0853717ba 100644 --- a/dev/sinic.cc +++ b/dev/sinic.cc @@ -1448,6 +1448,8 @@ Base::unserialize(Checkpoint *cp, const std::string §ion) void Device::serialize(ostream &os) { + int count; + // Serialize the PciDev base class Base::serialize(os); diff --git a/sim/serialize.cc b/sim/serialize.cc index ec7241498..c4ef124bb 100644 --- a/sim/serialize.cc +++ b/sim/serialize.cc @@ -51,8 +51,9 @@ using namespace std; -int Serializable::maxCount = 0; -int Serializable::count = 0; +int Serializable::ckptMaxCount = 0; +int Serializable::ckptCount = 0; +int Serializable::ckptPrevCount = -1; void Serializable::nameOut(ostream &os) @@ -241,8 +242,11 @@ Serializable::serializeAll() globals.serialize(outstream); SimObject::serializeAll(outstream); - if (maxCount && ++count >= maxCount) + assert(Serializable::ckptPrevCount + 1 == Serializable::ckptCount); + Serializable::ckptPrevCount++; + if (ckptMaxCount && ++ckptCount >= ckptMaxCount) SimExit(curTick + 1, "Maximum number of checkpoints dropped"); + } @@ -352,7 +356,7 @@ SerializeParamContext::checkParams() if (serialize_cycle > 0) Checkpoint::setup(serialize_cycle, serialize_period); - Serializable::maxCount = serialize_count; + Serializable::ckptMaxCount = serialize_count; } void diff --git a/sim/serialize.hh b/sim/serialize.hh index bc82bf9b8..d8f5f8fc5 100644 --- a/sim/serialize.hh +++ b/sim/serialize.hh @@ -119,8 +119,9 @@ class Serializable static Serializable *create(Checkpoint *cp, const std::string §ion); - static int count; - static int maxCount; + static int ckptCount; + static int ckptMaxCount; + static int ckptPrevCount; static void serializeAll(); static void unserializeGlobals(Checkpoint *cp); };