misc: Standardize the way create() constructs SimObjects.
The create() method on Params structs usually instantiate SimObjects using a constructor which takes the Params struct as a parameter somehow. There has been a lot of needless variation in how that was done, making it annoying to pass Params down to base classes. Some of the different forms were: const Params & Params & Params * const Params * Params const* This change goes through and fixes up every constructor and every create() method to use the const Params & form. We use a reference because the Params struct should never be null. We use const because neither the create method nor the consuming object should modify the record of the parameters as they came in from the config. That would make consuming them not idempotent, and make it impossible to tell what the actual simulation configuration was since it would change from any user visible form (config script, config.ini, dot pdf output). Change-Id: I77453cba52fdcfd5f4eec92dfb0bddb5a9945f31 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35938 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -58,7 +58,7 @@ ClockDomain::ClockDomainStats::ClockDomainStats(ClockDomain &cd)
|
||||
clock.scalar(cd._clockPeriod);
|
||||
}
|
||||
|
||||
ClockDomain::ClockDomain(const Params *p, VoltageDomain *voltage_domain)
|
||||
ClockDomain::ClockDomain(const Params &p, VoltageDomain *voltage_domain)
|
||||
: SimObject(p),
|
||||
_clockPeriod(0),
|
||||
_voltageDomain(voltage_domain),
|
||||
@@ -72,13 +72,13 @@ ClockDomain::voltage() const
|
||||
return _voltageDomain->voltage();
|
||||
}
|
||||
|
||||
SrcClockDomain::SrcClockDomain(const Params *p) :
|
||||
ClockDomain(p, p->voltage_domain),
|
||||
freqOpPoints(p->clock),
|
||||
_domainID(p->domain_id),
|
||||
_perfLevel(p->init_perf_level)
|
||||
SrcClockDomain::SrcClockDomain(const Params &p) :
|
||||
ClockDomain(p, p.voltage_domain),
|
||||
freqOpPoints(p.clock),
|
||||
_domainID(p.domain_id),
|
||||
_perfLevel(p.init_perf_level)
|
||||
{
|
||||
VoltageDomain *vdom = p->voltage_domain;
|
||||
VoltageDomain *vdom = p.voltage_domain;
|
||||
|
||||
fatal_if(freqOpPoints.empty(), "DVFS: Empty set of frequencies for "\
|
||||
"domain %d %s\n", _domainID, name());
|
||||
@@ -182,15 +182,15 @@ SrcClockDomain::startup()
|
||||
}
|
||||
|
||||
SrcClockDomain *
|
||||
SrcClockDomainParams::create()
|
||||
SrcClockDomainParams::create() const
|
||||
{
|
||||
return new SrcClockDomain(this);
|
||||
return new SrcClockDomain(*this);
|
||||
}
|
||||
|
||||
DerivedClockDomain::DerivedClockDomain(const Params *p) :
|
||||
ClockDomain(p, p->clk_domain->voltageDomain()),
|
||||
parent(*p->clk_domain),
|
||||
clockDivider(p->clk_divider)
|
||||
DerivedClockDomain::DerivedClockDomain(const Params &p) :
|
||||
ClockDomain(p, p.clk_domain->voltageDomain()),
|
||||
parent(*p.clk_domain),
|
||||
clockDivider(p.clk_divider)
|
||||
{
|
||||
// Ensure that clock divider setting works as frequency divider and never
|
||||
// work as frequency multiplier
|
||||
@@ -229,7 +229,7 @@ DerivedClockDomain::updateClockPeriod()
|
||||
}
|
||||
|
||||
DerivedClockDomain *
|
||||
DerivedClockDomainParams::create()
|
||||
DerivedClockDomainParams::create() const
|
||||
{
|
||||
return new DerivedClockDomain(this);
|
||||
return new DerivedClockDomain(*this);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ class ClockDomain : public SimObject
|
||||
public:
|
||||
|
||||
typedef ClockDomainParams Params;
|
||||
ClockDomain(const Params *p, VoltageDomain *voltage_domain);
|
||||
ClockDomain(const Params &p, VoltageDomain *voltage_domain);
|
||||
|
||||
/**
|
||||
* Get the clock period.
|
||||
@@ -166,7 +166,7 @@ class SrcClockDomain : public ClockDomain
|
||||
public:
|
||||
|
||||
typedef SrcClockDomainParams Params;
|
||||
SrcClockDomain(const Params *p);
|
||||
SrcClockDomain(const Params &p);
|
||||
|
||||
/**
|
||||
* Set new clock value
|
||||
@@ -275,7 +275,7 @@ class DerivedClockDomain: public ClockDomain
|
||||
public:
|
||||
|
||||
typedef DerivedClockDomainParams Params;
|
||||
DerivedClockDomain(const Params *p);
|
||||
DerivedClockDomain(const Params &p);
|
||||
|
||||
/**
|
||||
* Called by the parent clock domain to propagate changes. This
|
||||
|
||||
@@ -40,15 +40,15 @@
|
||||
#include "base/logging.hh"
|
||||
#include "sim/power/power_model.hh"
|
||||
|
||||
ClockedObject::ClockedObject(const ClockedObjectParams *p) :
|
||||
SimObject(p), Clocked(*p->clk_domain), powerState(p->power_state)
|
||||
ClockedObject::ClockedObject(const ClockedObjectParams &p) :
|
||||
SimObject(p), Clocked(*p.clk_domain), powerState(p.power_state)
|
||||
{
|
||||
// Register the power_model with the object
|
||||
// Slightly counter-intuitively, power models need to to register with the
|
||||
// clocked object and not the power stated object because the power model
|
||||
// needs information from the clock domain, which is an attribute of the
|
||||
// clocked object.
|
||||
for (auto & power_model: p->power_model)
|
||||
for (auto & power_model: p.power_model)
|
||||
power_model->setClockedObject(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -231,14 +231,14 @@ class Clocked
|
||||
class ClockedObject : public SimObject, public Clocked
|
||||
{
|
||||
public:
|
||||
ClockedObject(const ClockedObjectParams *p);
|
||||
ClockedObject(const ClockedObjectParams &p);
|
||||
|
||||
/** Parameters of ClockedObject */
|
||||
typedef ClockedObjectParams Params;
|
||||
const Params *
|
||||
const Params &
|
||||
params() const
|
||||
{
|
||||
return reinterpret_cast<const Params*>(_params);
|
||||
return reinterpret_cast<const Params&>(_params);
|
||||
}
|
||||
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
|
||||
@@ -54,15 +54,15 @@
|
||||
// DVFSHandler methods implementation
|
||||
//
|
||||
|
||||
DVFSHandler::DVFSHandler(const Params *p)
|
||||
DVFSHandler::DVFSHandler(const Params &p)
|
||||
: SimObject(p),
|
||||
sysClkDomain(p->sys_clk_domain),
|
||||
enableHandler(p->enable),
|
||||
_transLatency(p->transition_latency)
|
||||
sysClkDomain(p.sys_clk_domain),
|
||||
enableHandler(p.enable),
|
||||
_transLatency(p.transition_latency)
|
||||
{
|
||||
// Check supplied list of domains for sanity and add them to the
|
||||
// domain ID -> domain* hash
|
||||
for (auto dit = p->domains.begin(); dit != p->domains.end(); ++dit) {
|
||||
for (auto dit = p.domains.begin(); dit != p.domains.end(); ++dit) {
|
||||
SrcClockDomain *d = *dit;
|
||||
DomainID domain_id = d->domainID();
|
||||
|
||||
@@ -253,7 +253,7 @@ DVFSHandler::unserialize(CheckpointIn &cp)
|
||||
}
|
||||
|
||||
DVFSHandler*
|
||||
DVFSHandlerParams::create()
|
||||
DVFSHandlerParams::create() const
|
||||
{
|
||||
return new DVFSHandler(this);
|
||||
return new DVFSHandler(*this);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class DVFSHandler : public SimObject
|
||||
{
|
||||
public:
|
||||
typedef DVFSHandlerParams Params;
|
||||
DVFSHandler(const Params *p);
|
||||
DVFSHandler(const Params &p);
|
||||
|
||||
typedef SrcClockDomain::DomainID DomainID;
|
||||
typedef SrcClockDomain::PerfLevel PerfLevel;
|
||||
|
||||
@@ -58,8 +58,8 @@ class EmulatedDriver : public SimObject
|
||||
const std::string &filename;
|
||||
|
||||
public:
|
||||
EmulatedDriver(EmulatedDriverParams *p)
|
||||
: SimObject(p), filename(p->filename)
|
||||
EmulatedDriver(const EmulatedDriverParams &p)
|
||||
: SimObject(p), filename(p.filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ class InstRecord
|
||||
class InstTracer : public SimObject
|
||||
{
|
||||
public:
|
||||
InstTracer(const Params *p) : SimObject(p)
|
||||
InstTracer(const Params &p) : SimObject(p)
|
||||
{}
|
||||
|
||||
virtual ~InstTracer()
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "params/KernelWorkload.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
KernelWorkload::KernelWorkload(const Params &p) : Workload(&p), _params(p),
|
||||
KernelWorkload::KernelWorkload(const Params &p) : Workload(p), _params(p),
|
||||
_loadAddrMask(p.load_addr_mask), _loadAddrOffset(p.load_addr_offset),
|
||||
commandLine(p.command_line)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ KernelWorkload::unserialize(CheckpointIn &cp)
|
||||
}
|
||||
|
||||
KernelWorkload *
|
||||
KernelWorkloadParams::create()
|
||||
KernelWorkloadParams::create() const
|
||||
{
|
||||
return new KernelWorkload(*this);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
#include "sim/power/thermal_model.hh"
|
||||
#include "sim/sim_object.hh"
|
||||
|
||||
MathExprPowerModel::MathExprPowerModel(const Params *p)
|
||||
: PowerModelState(p), dyn_expr(p->dyn), st_expr(p->st)
|
||||
MathExprPowerModel::MathExprPowerModel(const Params &p)
|
||||
: PowerModelState(p), dyn_expr(p.dyn), st_expr(p.st)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ MathExprPowerModel::regStats()
|
||||
}
|
||||
|
||||
MathExprPowerModel*
|
||||
MathExprPowerModelParams::create()
|
||||
MathExprPowerModelParams::create() const
|
||||
{
|
||||
return new MathExprPowerModel(this);
|
||||
return new MathExprPowerModel(*this);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class MathExprPowerModel : public PowerModelState
|
||||
public:
|
||||
|
||||
typedef MathExprPowerModelParams Params;
|
||||
MathExprPowerModel(const Params *p);
|
||||
MathExprPowerModel(const Params &p);
|
||||
|
||||
/**
|
||||
* Get the dynamic power consumption.
|
||||
|
||||
@@ -43,14 +43,14 @@
|
||||
#include "sim/clocked_object.hh"
|
||||
#include "sim/sub_system.hh"
|
||||
|
||||
PowerModelState::PowerModelState(const Params *p)
|
||||
PowerModelState::PowerModelState(const Params &p)
|
||||
: SimObject(p), _temp(0), clocked_object(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
PowerModel::PowerModel(const Params *p)
|
||||
: SimObject(p), states_pm(p->pm), subsystem(p->subsystem),
|
||||
clocked_object(NULL), power_model_type(p->pm_type)
|
||||
PowerModel::PowerModel(const Params &p)
|
||||
: SimObject(p), states_pm(p.pm), subsystem(p.subsystem),
|
||||
clocked_object(NULL), power_model_type(p.pm_type)
|
||||
{
|
||||
panic_if(subsystem == NULL,
|
||||
"Subsystem is NULL! This is not acceptable for a PowerModel!\n");
|
||||
@@ -58,7 +58,7 @@ PowerModel::PowerModel(const Params *p)
|
||||
// The temperature passed here will be overwritten, if there is
|
||||
// a thermal model present
|
||||
for (auto & pms: states_pm){
|
||||
pms->setTemperature(p->ambient_temp);
|
||||
pms->setTemperature(p.ambient_temp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -88,9 +88,9 @@ PowerModel::regProbePoints()
|
||||
}
|
||||
|
||||
PowerModel*
|
||||
PowerModelParams::create()
|
||||
PowerModelParams::create() const
|
||||
{
|
||||
return new PowerModel(this);
|
||||
return new PowerModel(*this);
|
||||
}
|
||||
|
||||
double
|
||||
|
||||
@@ -56,7 +56,7 @@ class PowerModelState : public SimObject
|
||||
public:
|
||||
|
||||
typedef PowerModelStateParams Params;
|
||||
PowerModelState(const Params *p);
|
||||
PowerModelState(const Params &p);
|
||||
|
||||
/**
|
||||
* Get the dynamic power consumption.
|
||||
@@ -88,13 +88,13 @@ class PowerModelState : public SimObject
|
||||
|
||||
dynamicPower
|
||||
.method(this, &PowerModelState::getDynamicPower)
|
||||
.name(params()->name + ".dynamic_power")
|
||||
.name(params().name + ".dynamic_power")
|
||||
.desc("Dynamic power for this object (Watts)")
|
||||
;
|
||||
|
||||
staticPower
|
||||
.method(this, &PowerModelState::getStaticPower)
|
||||
.name(params()->name + ".static_power")
|
||||
.name(params().name + ".static_power")
|
||||
.desc("Static power for this object (Watts)")
|
||||
;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ class PowerModel : public SimObject
|
||||
public:
|
||||
|
||||
typedef PowerModelParams Params;
|
||||
PowerModel(const Params *p);
|
||||
PowerModel(const Params &p);
|
||||
|
||||
/**
|
||||
* Get the dynamic power consumption.
|
||||
@@ -141,13 +141,13 @@ class PowerModel : public SimObject
|
||||
|
||||
dynamicPower
|
||||
.method(this, &PowerModel::getDynamicPower)
|
||||
.name(params()->name + ".dynamic_power")
|
||||
.name(params().name + ".dynamic_power")
|
||||
.desc("Dynamic power for this power state")
|
||||
;
|
||||
|
||||
staticPower
|
||||
.method(this, &PowerModel::getStaticPower)
|
||||
.name(params()->name + ".static_power")
|
||||
.name(params().name + ".static_power")
|
||||
.desc("Static power for this power state")
|
||||
;
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
#include "sim/probe/probe.hh"
|
||||
#include "sim/sub_system.hh"
|
||||
|
||||
ThermalDomain::ThermalDomain(const Params *p)
|
||||
: SimObject(p), _initTemperature(p->initial_temperature),
|
||||
ThermalDomain::ThermalDomain(const Params &p)
|
||||
: SimObject(p), _initTemperature(p.initial_temperature),
|
||||
node(NULL), subsystem(NULL)
|
||||
{
|
||||
}
|
||||
@@ -77,7 +77,7 @@ ThermalDomain::regStats()
|
||||
|
||||
currentTemp
|
||||
.method(this, &ThermalDomain::currentTemperature)
|
||||
.name(params()->name + ".temp")
|
||||
.name(params().name + ".temp")
|
||||
.desc("Temperature in centigrate degrees")
|
||||
;
|
||||
}
|
||||
@@ -89,9 +89,9 @@ ThermalDomain::emitUpdate()
|
||||
}
|
||||
|
||||
ThermalDomain *
|
||||
ThermalDomainParams::create()
|
||||
ThermalDomainParams::create() const
|
||||
{
|
||||
return new ThermalDomain(this);
|
||||
return new ThermalDomain(*this);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -59,7 +59,7 @@ class ThermalDomain : public SimObject, public ThermalEntity
|
||||
public:
|
||||
|
||||
typedef ThermalDomainParams Params;
|
||||
ThermalDomain(const Params *p);
|
||||
ThermalDomain(const Params &p);
|
||||
|
||||
/**
|
||||
* Get the startup temperature.
|
||||
|
||||
@@ -49,15 +49,15 @@
|
||||
/**
|
||||
* ThermalReference
|
||||
*/
|
||||
ThermalReference::ThermalReference(const Params *p)
|
||||
: SimObject(p), _temperature(p->temperature), node(NULL)
|
||||
ThermalReference::ThermalReference(const Params &p)
|
||||
: SimObject(p), _temperature(p.temperature), node(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
ThermalReference *
|
||||
ThermalReferenceParams::create()
|
||||
ThermalReferenceParams::create() const
|
||||
{
|
||||
return new ThermalReference(this);
|
||||
return new ThermalReference(*this);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -82,15 +82,15 @@ ThermalReference::getEquation(ThermalNode * n, unsigned nnodes,
|
||||
/**
|
||||
* ThermalResistor
|
||||
*/
|
||||
ThermalResistor::ThermalResistor(const Params *p)
|
||||
: SimObject(p), _resistance(p->resistance), node1(NULL), node2(NULL)
|
||||
ThermalResistor::ThermalResistor(const Params &p)
|
||||
: SimObject(p), _resistance(p.resistance), node1(NULL), node2(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
ThermalResistor *
|
||||
ThermalResistorParams::create()
|
||||
ThermalResistorParams::create() const
|
||||
{
|
||||
return new ThermalResistor(this);
|
||||
return new ThermalResistor(*this);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -135,15 +135,15 @@ ThermalResistor::getEquation(ThermalNode * n, unsigned nnodes,
|
||||
/**
|
||||
* ThermalCapacitor
|
||||
*/
|
||||
ThermalCapacitor::ThermalCapacitor(const Params *p)
|
||||
: SimObject(p), _capacitance(p->capacitance), node1(NULL), node2(NULL)
|
||||
ThermalCapacitor::ThermalCapacitor(const Params &p)
|
||||
: SimObject(p), _capacitance(p.capacitance), node1(NULL), node2(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
ThermalCapacitor *
|
||||
ThermalCapacitorParams::create()
|
||||
ThermalCapacitorParams::create() const
|
||||
{
|
||||
return new ThermalCapacitor(this);
|
||||
return new ThermalCapacitor(*this);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -191,15 +191,15 @@ ThermalCapacitor::getEquation(ThermalNode * n, unsigned nnodes,
|
||||
/**
|
||||
* ThermalModel
|
||||
*/
|
||||
ThermalModel::ThermalModel(const Params *p)
|
||||
: ClockedObject(p), stepEvent([this]{ doStep(); }, name()), _step(p->step)
|
||||
ThermalModel::ThermalModel(const Params &p)
|
||||
: ClockedObject(p), stepEvent([this]{ doStep(); }, name()), _step(p.step)
|
||||
{
|
||||
}
|
||||
|
||||
ThermalModel *
|
||||
ThermalModelParams::create()
|
||||
ThermalModelParams::create() const
|
||||
{
|
||||
return new ThermalModel(this);
|
||||
return new ThermalModel(*this);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -60,7 +60,7 @@ class ThermalResistor : public SimObject, public ThermalEntity
|
||||
{
|
||||
public:
|
||||
typedef ThermalResistorParams Params;
|
||||
ThermalResistor(const Params *p);
|
||||
ThermalResistor(const Params &p);
|
||||
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
@@ -89,7 +89,7 @@ class ThermalCapacitor : public SimObject, public ThermalEntity
|
||||
{
|
||||
public:
|
||||
typedef ThermalCapacitorParams Params;
|
||||
ThermalCapacitor(const Params *p);
|
||||
ThermalCapacitor(const Params &p);
|
||||
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
@@ -117,9 +117,11 @@ class ThermalReference : public SimObject, public ThermalEntity
|
||||
{
|
||||
public:
|
||||
typedef ThermalReferenceParams Params;
|
||||
ThermalReference(const Params *p);
|
||||
ThermalReference(const Params &p);
|
||||
|
||||
void setNode(ThermalNode * n) {
|
||||
void
|
||||
setNode(ThermalNode *n)
|
||||
{
|
||||
node = n;
|
||||
}
|
||||
|
||||
@@ -148,7 +150,7 @@ class ThermalModel : public ClockedObject
|
||||
{
|
||||
public:
|
||||
typedef ThermalModelParams Params;
|
||||
ThermalModel(const Params *p);
|
||||
ThermalModel(const Params &p);
|
||||
|
||||
void addDomain(ThermalDomain * d);
|
||||
void addReference(ThermalReference * r);
|
||||
|
||||
@@ -43,13 +43,13 @@
|
||||
/**
|
||||
* ThermalNode
|
||||
*/
|
||||
ThermalNode::ThermalNode(const ThermalNodeParams *p)
|
||||
ThermalNode::ThermalNode(const ThermalNodeParams &p)
|
||||
: SimObject(p), id(-1), isref(false), temp(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
ThermalNode *
|
||||
ThermalNodeParams::create()
|
||||
ThermalNodeParams::create() const
|
||||
{
|
||||
return new ThermalNode(this);
|
||||
return new ThermalNode(*this);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ struct ThermalNodeParams;
|
||||
class ThermalNode : public SimObject
|
||||
{
|
||||
public:
|
||||
ThermalNode(const ThermalNodeParams *p);
|
||||
ThermalNode(const ThermalNodeParams &p);
|
||||
|
||||
int id;
|
||||
bool isref;
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
#include "base/trace.hh"
|
||||
#include "debug/PowerDomain.hh"
|
||||
|
||||
PowerDomain::PowerDomain(const PowerDomainParams* p) :
|
||||
PowerDomain::PowerDomain(const PowerDomainParams &p) :
|
||||
PowerState(p),
|
||||
leaders(p->leaders),
|
||||
leaders(p.leaders),
|
||||
pwrStateUpdateEvent(*this),
|
||||
stats(*this)
|
||||
{
|
||||
@@ -265,7 +265,7 @@ PowerDomain::PowerDomainStats::regStats()
|
||||
}
|
||||
|
||||
PowerDomain*
|
||||
PowerDomainParams::create()
|
||||
PowerDomainParams::create() const
|
||||
{
|
||||
return new PowerDomain(this);
|
||||
return new PowerDomain(*this);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
class PowerDomain : public PowerState
|
||||
{
|
||||
public:
|
||||
PowerDomain(const PowerDomainParams* p);
|
||||
PowerDomain(const PowerDomainParams &p);
|
||||
typedef PowerDomainParams Params;
|
||||
~PowerDomain() override {};
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@
|
||||
#include "debug/PowerDomain.hh"
|
||||
#include "sim/power_domain.hh"
|
||||
|
||||
PowerState::PowerState(const PowerStateParams *p) :
|
||||
SimObject(p), _currState(p->default_state),
|
||||
possibleStates(p->possible_states.begin(),
|
||||
p->possible_states.end()),
|
||||
PowerState::PowerState(const PowerStateParams &p) :
|
||||
SimObject(p), _currState(p.default_state),
|
||||
possibleStates(p.possible_states.begin(),
|
||||
p.possible_states.end()),
|
||||
stats(*this)
|
||||
{
|
||||
for (auto &pm: p->leaders) {
|
||||
for (auto &pm: p.leaders) {
|
||||
// Register this object as a follower. This object is
|
||||
// dependent on pm for power state transitions
|
||||
pm->addFollower(this);
|
||||
@@ -235,16 +235,15 @@ PowerState::PowerStateStats::regStats()
|
||||
|
||||
using namespace Stats;
|
||||
|
||||
const PowerStateParams *p = powerState.params();
|
||||
const PowerStateParams &p = powerState.params();
|
||||
|
||||
numTransitions.flags(nozero);
|
||||
numPwrMatchStateTransitions.flags(nozero);
|
||||
|
||||
// Each sample is time in ticks
|
||||
unsigned num_bins = std::max(p->clk_gate_bins, 10U);
|
||||
unsigned num_bins = std::max(p.clk_gate_bins, 10U);
|
||||
ticksClkGated
|
||||
.init(p->clk_gate_min, p->clk_gate_max,
|
||||
(p->clk_gate_max / num_bins))
|
||||
.init(p.clk_gate_min, p.clk_gate_max, (p.clk_gate_max / num_bins))
|
||||
.flags(pdf | nozero | nonan)
|
||||
;
|
||||
|
||||
@@ -276,7 +275,7 @@ PowerState::PowerStateStats::preDumpStats()
|
||||
}
|
||||
|
||||
PowerState*
|
||||
PowerStateParams::create()
|
||||
PowerStateParams::create() const
|
||||
{
|
||||
return new PowerState(this);
|
||||
return new PowerState(*this);
|
||||
}
|
||||
|
||||
@@ -61,13 +61,14 @@ class PowerDomain;
|
||||
class PowerState : public SimObject
|
||||
{
|
||||
public:
|
||||
PowerState(const PowerStateParams *p);
|
||||
PowerState(const PowerStateParams &p);
|
||||
|
||||
/** Parameters of PowerState object */
|
||||
typedef PowerStateParams Params;
|
||||
const Params* params() const
|
||||
const Params &
|
||||
params() const
|
||||
{
|
||||
return reinterpret_cast<const Params*>(_params);
|
||||
return reinterpret_cast<const Params &>(_params);
|
||||
}
|
||||
|
||||
virtual void addFollower(PowerState* pwr_obj) {};
|
||||
|
||||
@@ -48,9 +48,10 @@ ProbePoint::ProbePoint(ProbeManager *manager, const std::string& _name)
|
||||
}
|
||||
}
|
||||
|
||||
ProbeListenerObject::ProbeListenerObject(const ProbeListenerObjectParams *params)
|
||||
ProbeListenerObject::ProbeListenerObject(
|
||||
const ProbeListenerObjectParams ¶ms)
|
||||
: SimObject(params),
|
||||
manager(params->manager->getProbeManager())
|
||||
manager(params.manager->getProbeManager())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -74,9 +75,9 @@ ProbeListener::~ProbeListener()
|
||||
}
|
||||
|
||||
ProbeListenerObject*
|
||||
ProbeListenerObjectParams::create()
|
||||
ProbeListenerObjectParams::create() const
|
||||
{
|
||||
return new ProbeListenerObject(this);
|
||||
return new ProbeListenerObject(*this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -102,7 +102,7 @@ class ProbeListenerObject : public SimObject
|
||||
std::vector<ProbeListener *> listeners;
|
||||
|
||||
public:
|
||||
ProbeListenerObject(const ProbeListenerObjectParams *params);
|
||||
ProbeListenerObject(const ProbeListenerObjectParams ¶ms);
|
||||
virtual ~ProbeListenerObject();
|
||||
ProbeManager* getProbeManager() { return manager; }
|
||||
};
|
||||
|
||||
@@ -90,7 +90,8 @@ Process::Loader::Loader()
|
||||
}
|
||||
|
||||
Process *
|
||||
Process::tryLoaders(ProcessParams *params, ::Loader::ObjectFile *obj_file)
|
||||
Process::tryLoaders(const ProcessParams ¶ms,
|
||||
::Loader::ObjectFile *obj_file)
|
||||
{
|
||||
for (auto &loader: process_loaders()) {
|
||||
Process *p = loader->load(params, obj_file);
|
||||
@@ -102,31 +103,31 @@ Process::tryLoaders(ProcessParams *params, ::Loader::ObjectFile *obj_file)
|
||||
}
|
||||
|
||||
static std::string
|
||||
normalize(std::string& directory)
|
||||
normalize(const std::string& directory)
|
||||
{
|
||||
if (directory.back() != '/')
|
||||
directory += '/';
|
||||
return directory + '/';
|
||||
return directory;
|
||||
}
|
||||
|
||||
Process::Process(ProcessParams *params, EmulationPageTable *pTable,
|
||||
Process::Process(const ProcessParams ¶ms, EmulationPageTable *pTable,
|
||||
::Loader::ObjectFile *obj_file)
|
||||
: SimObject(params), system(params->system),
|
||||
useArchPT(params->useArchPT),
|
||||
kvmInSE(params->kvmInSE),
|
||||
: SimObject(params), system(params.system),
|
||||
useArchPT(params.useArchPT),
|
||||
kvmInSE(params.kvmInSE),
|
||||
useForClone(false),
|
||||
pTable(pTable),
|
||||
objFile(obj_file),
|
||||
argv(params->cmd), envp(params->env),
|
||||
executable(params->executable),
|
||||
tgtCwd(normalize(params->cwd)),
|
||||
argv(params.cmd), envp(params.env),
|
||||
executable(params.executable == "" ? params.cmd[0] : params.executable),
|
||||
tgtCwd(normalize(params.cwd)),
|
||||
hostCwd(checkPathRedirect(tgtCwd)),
|
||||
release(params->release),
|
||||
_uid(params->uid), _euid(params->euid),
|
||||
_gid(params->gid), _egid(params->egid),
|
||||
_pid(params->pid), _ppid(params->ppid),
|
||||
_pgid(params->pgid), drivers(params->drivers),
|
||||
fds(make_shared<FDArray>(params->input, params->output, params->errout)),
|
||||
release(params.release),
|
||||
_uid(params.uid), _euid(params.euid),
|
||||
_gid(params.gid), _egid(params.egid),
|
||||
_pid(params.pid), _ppid(params.ppid),
|
||||
_pgid(params.pgid), drivers(params.drivers),
|
||||
fds(make_shared<FDArray>(params.input, params.output, params.errout)),
|
||||
childClearTID(0)
|
||||
{
|
||||
if (_pid >= System::maxPID)
|
||||
@@ -148,7 +149,7 @@ Process::Process(ProcessParams *params, EmulationPageTable *pTable,
|
||||
* with a new, equivalent value. If CLONE_THREAD is specified, patch
|
||||
* the tgid value with the old process' value.
|
||||
*/
|
||||
_tgid = params->pid;
|
||||
_tgid = params.pid;
|
||||
|
||||
exitGroup = new bool();
|
||||
sigchld = new bool();
|
||||
@@ -508,18 +509,16 @@ Process::absolutePath(const std::string &filename, bool host_filesystem)
|
||||
}
|
||||
|
||||
Process *
|
||||
ProcessParams::create()
|
||||
ProcessParams::create() const
|
||||
{
|
||||
// If not specified, set the executable parameter equal to the
|
||||
// simulated system's zeroth command line parameter
|
||||
if (executable == "") {
|
||||
executable = cmd[0];
|
||||
}
|
||||
const std::string &exec = (executable == "") ? cmd[0] : executable;
|
||||
|
||||
auto *obj_file = Loader::createObjectFile(executable);
|
||||
fatal_if(!obj_file, "Cannot load object file %s.", executable);
|
||||
auto *obj_file = Loader::createObjectFile(exec);
|
||||
fatal_if(!obj_file, "Cannot load object file %s.", exec);
|
||||
|
||||
Process *process = Process::tryLoaders(this, obj_file);
|
||||
Process *process = Process::tryLoaders(*this, obj_file);
|
||||
fatal_if(!process, "Unknown error creating process object.");
|
||||
|
||||
return process;
|
||||
|
||||
@@ -65,7 +65,7 @@ class ThreadContext;
|
||||
class Process : public SimObject
|
||||
{
|
||||
public:
|
||||
Process(ProcessParams *params, EmulationPageTable *pTable,
|
||||
Process(const ProcessParams ¶ms, EmulationPageTable *pTable,
|
||||
::Loader::ObjectFile *obj_file);
|
||||
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
@@ -201,13 +201,13 @@ class Process : public SimObject
|
||||
* error like file IO errors, etc., those should fail non-silently
|
||||
* with a panic or fail as normal.
|
||||
*/
|
||||
virtual Process *load(ProcessParams *params,
|
||||
virtual Process *load(const ProcessParams ¶ms,
|
||||
::Loader::ObjectFile *obj_file) = 0;
|
||||
};
|
||||
|
||||
// Try all the Loader instance's "load" methods one by one until one is
|
||||
// successful. If none are, complain and fail.
|
||||
static Process *tryLoaders(ProcessParams *params,
|
||||
static Process *tryLoaders(const ProcessParams ¶ms,
|
||||
::Loader::ObjectFile *obj_file);
|
||||
|
||||
::Loader::ObjectFile *objFile;
|
||||
|
||||
@@ -214,7 +214,7 @@ loadsymbol(ThreadContext *tc)
|
||||
if (!FullSystem)
|
||||
panicFsOnlyPseudoInst("loadsymbol");
|
||||
|
||||
const string &filename = tc->getCpuPtr()->system->params()->symbolfile;
|
||||
const string &filename = tc->getCpuPtr()->system->params().symbolfile;
|
||||
if (filename.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ void
|
||||
resetstats(ThreadContext *tc, Tick delay, Tick period)
|
||||
{
|
||||
DPRINTF(PseudoInst, "PseudoInst::resetstats(%i, %i)\n", delay, period);
|
||||
if (!tc->getCpuPtr()->params()->do_statistics_insts)
|
||||
if (!tc->getCpuPtr()->params().do_statistics_insts)
|
||||
return;
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ void
|
||||
dumpstats(ThreadContext *tc, Tick delay, Tick period)
|
||||
{
|
||||
DPRINTF(PseudoInst, "PseudoInst::dumpstats(%i, %i)\n", delay, period);
|
||||
if (!tc->getCpuPtr()->params()->do_statistics_insts)
|
||||
if (!tc->getCpuPtr()->params().do_statistics_insts)
|
||||
return;
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ void
|
||||
dumpresetstats(ThreadContext *tc, Tick delay, Tick period)
|
||||
{
|
||||
DPRINTF(PseudoInst, "PseudoInst::dumpresetstats(%i, %i)\n", delay, period);
|
||||
if (!tc->getCpuPtr()->params()->do_statistics_insts)
|
||||
if (!tc->getCpuPtr()->params().do_statistics_insts)
|
||||
return;
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ void
|
||||
m5checkpoint(ThreadContext *tc, Tick delay, Tick period)
|
||||
{
|
||||
DPRINTF(PseudoInst, "PseudoInst::m5checkpoint(%i, %i)\n", delay, period);
|
||||
if (!tc->getCpuPtr()->params()->do_checkpoint_insts)
|
||||
if (!tc->getCpuPtr()->params().do_checkpoint_insts)
|
||||
return;
|
||||
|
||||
if (DistIface::readyToCkpt(delay, period)) {
|
||||
@@ -380,7 +380,7 @@ readfile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const string &file = tc->getSystemPtr()->params()->readfile;
|
||||
const string &file = tc->getSystemPtr()->params().readfile;
|
||||
if (file.empty()) {
|
||||
return ULL(0);
|
||||
}
|
||||
@@ -499,9 +499,9 @@ workbegin(ThreadContext *tc, uint64_t workid, uint64_t threadid)
|
||||
{
|
||||
DPRINTF(PseudoInst, "PseudoInst::workbegin(%i, %i)\n", workid, threadid);
|
||||
System *sys = tc->getSystemPtr();
|
||||
const System::Params *params = sys->params();
|
||||
const System::Params ¶ms = sys->params();
|
||||
|
||||
if (params->exit_on_work_items) {
|
||||
if (params.exit_on_work_items) {
|
||||
exitSimLoop("workbegin", static_cast<int>(workid));
|
||||
return;
|
||||
}
|
||||
@@ -515,20 +515,20 @@ workbegin(ThreadContext *tc, uint64_t workid, uint64_t threadid)
|
||||
// If specified, determine if this is the specific work item the user
|
||||
// identified
|
||||
//
|
||||
if (params->work_item_id == -1 || params->work_item_id == workid) {
|
||||
if (params.work_item_id == -1 || params.work_item_id == workid) {
|
||||
|
||||
uint64_t systemWorkBeginCount = sys->incWorkItemsBegin();
|
||||
int cpuId = tc->getCpuPtr()->cpuId();
|
||||
|
||||
if (params->work_cpus_ckpt_count != 0 &&
|
||||
sys->markWorkItem(cpuId) >= params->work_cpus_ckpt_count) {
|
||||
if (params.work_cpus_ckpt_count != 0 &&
|
||||
sys->markWorkItem(cpuId) >= params.work_cpus_ckpt_count) {
|
||||
//
|
||||
// If active cpus equals checkpoint count, create checkpoint
|
||||
//
|
||||
exitSimLoop("checkpoint");
|
||||
}
|
||||
|
||||
if (systemWorkBeginCount == params->work_begin_ckpt_count) {
|
||||
if (systemWorkBeginCount == params.work_begin_ckpt_count) {
|
||||
//
|
||||
// Note: the string specified as the cause of the exit event must
|
||||
// exactly equal "checkpoint" inorder to create a checkpoint
|
||||
@@ -536,14 +536,14 @@ workbegin(ThreadContext *tc, uint64_t workid, uint64_t threadid)
|
||||
exitSimLoop("checkpoint");
|
||||
}
|
||||
|
||||
if (systemWorkBeginCount == params->work_begin_exit_count) {
|
||||
if (systemWorkBeginCount == params.work_begin_exit_count) {
|
||||
//
|
||||
// If a certain number of work items started, exit simulation
|
||||
//
|
||||
exitSimLoop("work started count reach");
|
||||
}
|
||||
|
||||
if (cpuId == params->work_begin_cpu_id_exit) {
|
||||
if (cpuId == params.work_begin_cpu_id_exit) {
|
||||
//
|
||||
// If work started on the cpu id specified, exit simulation
|
||||
//
|
||||
@@ -562,9 +562,9 @@ workend(ThreadContext *tc, uint64_t workid, uint64_t threadid)
|
||||
{
|
||||
DPRINTF(PseudoInst, "PseudoInst::workend(%i, %i)\n", workid, threadid);
|
||||
System *sys = tc->getSystemPtr();
|
||||
const System::Params *params = sys->params();
|
||||
const System::Params ¶ms = sys->params();
|
||||
|
||||
if (params->exit_on_work_items) {
|
||||
if (params.exit_on_work_items) {
|
||||
exitSimLoop("workend", static_cast<int>(workid));
|
||||
return;
|
||||
}
|
||||
@@ -577,21 +577,21 @@ workend(ThreadContext *tc, uint64_t workid, uint64_t threadid)
|
||||
// If specified, determine if this is the specific work item the user
|
||||
// identified
|
||||
//
|
||||
if (params->work_item_id == -1 || params->work_item_id == workid) {
|
||||
if (params.work_item_id == -1 || params.work_item_id == workid) {
|
||||
|
||||
uint64_t systemWorkEndCount = sys->incWorkItemsEnd();
|
||||
int cpuId = tc->getCpuPtr()->cpuId();
|
||||
|
||||
if (params->work_cpus_ckpt_count != 0 &&
|
||||
sys->markWorkItem(cpuId) >= params->work_cpus_ckpt_count) {
|
||||
if (params.work_cpus_ckpt_count != 0 &&
|
||||
sys->markWorkItem(cpuId) >= params.work_cpus_ckpt_count) {
|
||||
//
|
||||
// If active cpus equals checkpoint count, create checkpoint
|
||||
//
|
||||
exitSimLoop("checkpoint");
|
||||
}
|
||||
|
||||
if (params->work_end_ckpt_count != 0 &&
|
||||
systemWorkEndCount == params->work_end_ckpt_count) {
|
||||
if (params.work_end_ckpt_count != 0 &&
|
||||
systemWorkEndCount == params.work_end_ckpt_count) {
|
||||
//
|
||||
// If total work items completed equals checkpoint count, create
|
||||
// checkpoint
|
||||
@@ -599,8 +599,8 @@ workend(ThreadContext *tc, uint64_t workid, uint64_t threadid)
|
||||
exitSimLoop("checkpoint");
|
||||
}
|
||||
|
||||
if (params->work_end_exit_count != 0 &&
|
||||
systemWorkEndCount == params->work_end_exit_count) {
|
||||
if (params.work_end_exit_count != 0 &&
|
||||
systemWorkEndCount == params.work_end_exit_count) {
|
||||
//
|
||||
// If total work items completed equals exit count, exit simulation
|
||||
//
|
||||
|
||||
@@ -44,18 +44,18 @@ normalizePath(std::string path)
|
||||
return path;
|
||||
}
|
||||
|
||||
RedirectPath::RedirectPath(const RedirectPathParams *p)
|
||||
RedirectPath::RedirectPath(const RedirectPathParams &p)
|
||||
: SimObject(p)
|
||||
{
|
||||
_appPath = normalizePath(p->app_path);
|
||||
_appPath = normalizePath(p.app_path);
|
||||
|
||||
for (auto hp : p->host_paths) {
|
||||
for (auto hp : p.host_paths) {
|
||||
_hostPaths.push_back(normalizePath(hp));
|
||||
}
|
||||
}
|
||||
|
||||
RedirectPath*
|
||||
RedirectPathParams::create()
|
||||
RedirectPathParams::create() const
|
||||
{
|
||||
return new RedirectPath(this);
|
||||
return new RedirectPath(*this);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
class RedirectPath : public SimObject
|
||||
{
|
||||
public:
|
||||
RedirectPath(const RedirectPathParams *p);
|
||||
RedirectPath(const RedirectPathParams &p);
|
||||
|
||||
const std::string& appPath() { return _appPath; };
|
||||
const std::vector<std::string>& hostPaths() { return _hostPaths; };
|
||||
|
||||
@@ -163,18 +163,18 @@ Root::timeSyncSpinThreshold(Time newThreshold)
|
||||
timeSyncEnable(en);
|
||||
}
|
||||
|
||||
Root::Root(RootParams *p)
|
||||
: SimObject(p), _enabled(false), _periodTick(p->time_sync_period),
|
||||
Root::Root(const RootParams &p)
|
||||
: SimObject(p), _enabled(false), _periodTick(p.time_sync_period),
|
||||
syncEvent([this]{ timeSync(); }, name())
|
||||
{
|
||||
_period.setTick(p->time_sync_period);
|
||||
_spinThreshold.setTick(p->time_sync_spin_threshold);
|
||||
_period.setTick(p.time_sync_period);
|
||||
_spinThreshold.setTick(p.time_sync_spin_threshold);
|
||||
|
||||
assert(_root == NULL);
|
||||
_root = this;
|
||||
lastTime.setTimer();
|
||||
|
||||
simQuantum = p->sim_quantum;
|
||||
simQuantum = p.sim_quantum;
|
||||
|
||||
// Some of the statistics are global and need to be accessed by
|
||||
// stat formulas. The most convenient way to implement that is by
|
||||
@@ -186,7 +186,7 @@ Root::Root(RootParams *p)
|
||||
void
|
||||
Root::startup()
|
||||
{
|
||||
timeSyncEnable(params()->time_sync_enable);
|
||||
timeSyncEnable(params().time_sync_enable);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -202,7 +202,7 @@ bool FullSystem;
|
||||
unsigned int FullSystemInt;
|
||||
|
||||
Root *
|
||||
RootParams::create()
|
||||
RootParams::create() const
|
||||
{
|
||||
static bool created = false;
|
||||
if (created)
|
||||
@@ -213,5 +213,5 @@ RootParams::create()
|
||||
FullSystem = full_system;
|
||||
FullSystemInt = full_system ? 1 : 0;
|
||||
|
||||
return new Root(this);
|
||||
return new Root(*this);
|
||||
}
|
||||
|
||||
@@ -132,13 +132,13 @@ class Root : public SimObject
|
||||
void timeSyncSpinThreshold(Time newThreshold);
|
||||
|
||||
typedef RootParams Params;
|
||||
const Params *
|
||||
const Params &
|
||||
params() const
|
||||
{
|
||||
return dynamic_cast<const Params *>(_params);
|
||||
return dynamic_cast<const Params &>(_params);
|
||||
}
|
||||
|
||||
Root(Params *p);
|
||||
Root(const Params &p);
|
||||
|
||||
/** Schedule the timesync event at startup().
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "params/SEWorkload.hh"
|
||||
#include "sim/process.hh"
|
||||
|
||||
SEWorkload::SEWorkload(const Params &p) : Workload(&p), _params(p)
|
||||
SEWorkload::SEWorkload(const Params &p) : Workload(p), _params(p)
|
||||
{}
|
||||
|
||||
void
|
||||
@@ -41,7 +41,7 @@ SEWorkload::syscall(ThreadContext *tc)
|
||||
}
|
||||
|
||||
SEWorkload *
|
||||
SEWorkloadParams::create()
|
||||
SEWorkloadParams::create() const
|
||||
{
|
||||
return new SEWorkload(*this);
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ SimObject::SimObjectList SimObject::simObjectList;
|
||||
//
|
||||
// SimObject constructor: used to maintain static simObjectList
|
||||
//
|
||||
SimObject::SimObject(const Params *p)
|
||||
: EventManager(getEventQueue(p->eventq_index)),
|
||||
SimObject::SimObject(const Params &p)
|
||||
: EventManager(getEventQueue(p.eventq_index)),
|
||||
Stats::Group(nullptr),
|
||||
_params(p)
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@ class SimObject : public EventManager, public Serializable, public Drainable,
|
||||
*
|
||||
* @ingroup api_simobject
|
||||
*/
|
||||
const SimObjectParams *_params;
|
||||
const SimObjectParams &_params;
|
||||
|
||||
public:
|
||||
typedef SimObjectParams Params;
|
||||
@@ -116,12 +116,12 @@ class SimObject : public EventManager, public Serializable, public Drainable,
|
||||
*
|
||||
* @ingroup api_simobject
|
||||
*/
|
||||
const Params *params() const { return _params; }
|
||||
const Params ¶ms() const { return _params; }
|
||||
|
||||
/**
|
||||
* @ingroup api_simobject
|
||||
*/
|
||||
SimObject(const Params *_params);
|
||||
SimObject(const Params &_params);
|
||||
|
||||
virtual ~SimObject();
|
||||
|
||||
@@ -130,7 +130,7 @@ class SimObject : public EventManager, public Serializable, public Drainable,
|
||||
/**
|
||||
* @ingroup api_simobject
|
||||
*/
|
||||
virtual const std::string name() const { return params()->name; }
|
||||
virtual const std::string name() const { return params().name; }
|
||||
|
||||
/**
|
||||
* init() is called after all C++ SimObjects have been created and
|
||||
|
||||
@@ -41,12 +41,12 @@
|
||||
#include "sim/power/power_model.hh"
|
||||
#include "sim/power/thermal_domain.hh"
|
||||
|
||||
SubSystem::SubSystem(const Params *p)
|
||||
SubSystem::SubSystem(const Params &p)
|
||||
: SimObject(p)
|
||||
{
|
||||
// Link thermalDomain <-> SubSystem
|
||||
if (p->thermal_domain)
|
||||
p->thermal_domain->setSubSystem(this);
|
||||
if (p.thermal_domain)
|
||||
p.thermal_domain->setSubSystem(this);
|
||||
}
|
||||
|
||||
double
|
||||
@@ -68,7 +68,7 @@ SubSystem::getStaticPower() const
|
||||
}
|
||||
|
||||
SubSystem *
|
||||
SubSystemParams::create()
|
||||
SubSystemParams::create() const
|
||||
{
|
||||
return new SubSystem(this);
|
||||
return new SubSystem(*this);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class SubSystem : public SimObject
|
||||
{
|
||||
public:
|
||||
typedef SubSystemParams Params;
|
||||
SubSystem(const Params *p);
|
||||
SubSystem(const Params &p);
|
||||
|
||||
double getDynamicPower() const;
|
||||
|
||||
|
||||
@@ -205,32 +205,32 @@ System::Threads::quiesceTick(ContextID id, Tick when)
|
||||
|
||||
int System::numSystemsRunning = 0;
|
||||
|
||||
System::System(Params *p)
|
||||
System::System(const Params &p)
|
||||
: SimObject(p), _systemPort("system_port", this),
|
||||
multiThread(p->multi_thread),
|
||||
multiThread(p.multi_thread),
|
||||
pagePtr(0),
|
||||
init_param(p->init_param),
|
||||
physProxy(_systemPort, p->cache_line_size),
|
||||
workload(p->workload),
|
||||
init_param(p.init_param),
|
||||
physProxy(_systemPort, p.cache_line_size),
|
||||
workload(p.workload),
|
||||
#if USE_KVM
|
||||
kvmVM(p->kvm_vm),
|
||||
kvmVM(p.kvm_vm),
|
||||
#else
|
||||
kvmVM(nullptr),
|
||||
#endif
|
||||
physmem(name() + ".physmem", p->memories, p->mmap_using_noreserve,
|
||||
p->shared_backstore),
|
||||
memoryMode(p->mem_mode),
|
||||
_cacheLineSize(p->cache_line_size),
|
||||
physmem(name() + ".physmem", p.memories, p.mmap_using_noreserve,
|
||||
p.shared_backstore),
|
||||
memoryMode(p.mem_mode),
|
||||
_cacheLineSize(p.cache_line_size),
|
||||
workItemsBegin(0),
|
||||
workItemsEnd(0),
|
||||
numWorkIds(p->num_work_ids),
|
||||
thermalModel(p->thermal_model),
|
||||
numWorkIds(p.num_work_ids),
|
||||
thermalModel(p.thermal_model),
|
||||
_params(p),
|
||||
_m5opRange(p->m5ops_base ?
|
||||
RangeSize(p->m5ops_base, 0x10000) :
|
||||
_m5opRange(p.m5ops_base ?
|
||||
RangeSize(p.m5ops_base, 0x10000) :
|
||||
AddrRange(1, 0)), // Create an empty range if disabled
|
||||
totalNumInsts(0),
|
||||
redirectPaths(p->redirect_paths)
|
||||
redirectPaths(p.redirect_paths)
|
||||
{
|
||||
if (workload)
|
||||
workload->system = this;
|
||||
@@ -262,8 +262,8 @@ System::System(Params *p)
|
||||
numSystemsRunning++;
|
||||
|
||||
// Set back pointers to the system in all memories
|
||||
for (int x = 0; x < params()->memories.size(); x++)
|
||||
params()->memories[x]->system(this);
|
||||
for (int x = 0; x < params().memories.size(); x++)
|
||||
params().memories[x]->system(this);
|
||||
}
|
||||
|
||||
System::~System()
|
||||
@@ -653,7 +653,7 @@ System::getRequestorName(RequestorID requestor_id)
|
||||
}
|
||||
|
||||
System *
|
||||
SystemParams::create()
|
||||
SystemParams::create() const
|
||||
{
|
||||
return new System(this);
|
||||
return new System(*this);
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ class System : public SimObject, public PCEventScope
|
||||
ByteOrder
|
||||
getGuestByteOrder() const
|
||||
{
|
||||
return _params->byte_order;
|
||||
return _params.byte_order;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -558,7 +558,7 @@ class System : public SimObject, public PCEventScope
|
||||
typedef SystemParams Params;
|
||||
|
||||
protected:
|
||||
Params *_params;
|
||||
const Params &_params;
|
||||
|
||||
/**
|
||||
* Range for memory-mapped m5 pseudo ops. The range will be
|
||||
@@ -567,10 +567,10 @@ class System : public SimObject, public PCEventScope
|
||||
const AddrRange _m5opRange;
|
||||
|
||||
public:
|
||||
System(Params *p);
|
||||
System(const Params &p);
|
||||
~System();
|
||||
|
||||
const Params *params() const { return (const Params *)_params; }
|
||||
const Params ¶ms() const { return (const Params &)_params; }
|
||||
|
||||
/**
|
||||
* Range used by memory-mapped m5 pseudo-ops if enabled. Returns
|
||||
|
||||
@@ -106,7 +106,7 @@ Ticked::unserialize(CheckpointIn &cp)
|
||||
lastStopped = Cycles(lastStoppedUint);
|
||||
}
|
||||
|
||||
TickedObject::TickedObject(const TickedObjectParams *params,
|
||||
TickedObject::TickedObject(const TickedObjectParams ¶ms,
|
||||
Event::Priority priority) :
|
||||
ClockedObject(params),
|
||||
/* Make numCycles in Ticked */
|
||||
|
||||
@@ -163,7 +163,7 @@ class Ticked : public Serializable
|
||||
class TickedObject : public ClockedObject, public Ticked
|
||||
{
|
||||
public:
|
||||
TickedObject(const TickedObjectParams *params,
|
||||
TickedObject(const TickedObjectParams ¶ms,
|
||||
Event::Priority priority = Event::CPU_Tick_Pri);
|
||||
|
||||
/** Disambiguate to make these functions overload correctly */
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
#include "params/VoltageDomain.hh"
|
||||
#include "sim/sim_object.hh"
|
||||
|
||||
VoltageDomain::VoltageDomain(const Params *p)
|
||||
: SimObject(p), voltageOpPoints(p->voltage), _perfLevel(0), stats(*this)
|
||||
VoltageDomain::VoltageDomain(const Params &p)
|
||||
: SimObject(p), voltageOpPoints(p.voltage), _perfLevel(0), stats(*this)
|
||||
{
|
||||
fatal_if(voltageOpPoints.empty(), "DVFS: Empty set of voltages for "\
|
||||
"voltage domain %s\n", name());
|
||||
@@ -125,9 +125,9 @@ VoltageDomain::startup() {
|
||||
}
|
||||
|
||||
VoltageDomain *
|
||||
VoltageDomainParams::create()
|
||||
VoltageDomainParams::create() const
|
||||
{
|
||||
return new VoltageDomain(this);
|
||||
return new VoltageDomain(*this);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -55,7 +55,7 @@ class VoltageDomain : public SimObject
|
||||
public:
|
||||
|
||||
typedef VoltageDomainParams Params;
|
||||
VoltageDomain(const Params *p);
|
||||
VoltageDomain(const Params &p);
|
||||
|
||||
typedef SrcClockDomain::PerfLevel PerfLevel;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class Workload : public SimObject
|
||||
} stats;
|
||||
|
||||
public:
|
||||
Workload(const WorkloadParams *_params) : SimObject(_params), stats(this)
|
||||
Workload(const WorkloadParams &_params) : SimObject(_params), stats(this)
|
||||
{}
|
||||
|
||||
void recordQuiesce() { stats.quiesce++; }
|
||||
|
||||
Reference in New Issue
Block a user