sim: revamp unserialization procedure
authorSteve Reinhardt <steve.reinhardt@amd.com>
Tue, 17 Aug 2010 12:17:06 +0000 (05:17 -0700)
committerSteve Reinhardt <steve.reinhardt@amd.com>
Tue, 17 Aug 2010 12:17:06 +0000 (05:17 -0700)
commitf064aa306061ecc468efd8cf148ed08398ca824d
treed78548dc953bb621d9154249d07022dabf2f6e2c
parent2519d116c9171ed4bf220d5049f244b333aa0842
sim: revamp unserialization procedure

Replace direct call to unserialize() on each SimObject with a pair of
calls for better control over initialization in both ckpt and non-ckpt
cases.

If restoring from a checkpoint, loadState(ckpt) is called on each
SimObject.  The default implementation simply calls unserialize() if
there is a corresponding checkpoint section, so we get backward
compatibility for existing objects.  However, objects can override
loadState() to get other behaviors, e.g., doing other programmed
initializations after unserialize(), or complaining if no checkpoint
section is found.  (Note that the default warning for a missing
checkpoint section is now gone.)

If not restoring from a checkpoint, we call the new initState() method
on each SimObject instead.  This provides a hook for state
initializations that are only required when *not* restoring from a
checkpoint.

Given this new framework, do some cleanup of LiveProcess subclasses
and X86System, which were (in some cases) emulating initState()
behavior in startup via a local flag or (in other cases) erroneously
doing initializations in startup() that clobbered state loaded earlier
by unserialize().
27 files changed:
src/arch/alpha/process.cc
src/arch/alpha/process.hh
src/arch/arm/process.cc
src/arch/mips/process.cc
src/arch/mips/process.hh
src/arch/power/linux/process.cc
src/arch/power/linux/process.hh
src/arch/power/process.cc
src/arch/power/process.hh
src/arch/sparc/process.cc
src/arch/sparc/process.hh
src/arch/x86/linux/system.cc
src/arch/x86/linux/system.hh
src/arch/x86/process.cc
src/arch/x86/process.hh
src/arch/x86/system.cc
src/arch/x86/system.hh
src/python/m5/simulate.py
src/python/swig/core.i
src/python/swig/pyobject.hh
src/python/swig/sim_object.i
src/sim/process.cc
src/sim/process.hh
src/sim/serialize.cc
src/sim/serialize.hh
src/sim/sim_object.cc
src/sim/sim_object.hh