inorder: object cleanup in destructors
This commit is contained in:
parent
1a89e8f4cb
commit
f3bc2df663
10 changed files with 29 additions and 7 deletions
|
@ -347,6 +347,11 @@ InOrderCPU::InOrderCPU(Params *params)
|
||||||
scheduleTickEvent(0);
|
scheduleTickEvent(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InOrderCPU::~InOrderCPU()
|
||||||
|
{
|
||||||
|
delete resPool;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InOrderCPU::regStats()
|
InOrderCPU::regStats()
|
||||||
|
|
|
@ -93,7 +93,9 @@ class InOrderCPU : public BaseCPU
|
||||||
public:
|
public:
|
||||||
/** Constructs a CPU with the given parameters. */
|
/** Constructs a CPU with the given parameters. */
|
||||||
InOrderCPU(Params *params);
|
InOrderCPU(Params *params);
|
||||||
|
/* Destructor */
|
||||||
|
~InOrderCPU();
|
||||||
|
|
||||||
/** CPU ID */
|
/** CPU ID */
|
||||||
int cpu_id;
|
int cpu_id;
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ Resource::Resource(string res_name, int res_id, int res_width,
|
||||||
Resource::~Resource()
|
Resource::~Resource()
|
||||||
{
|
{
|
||||||
delete [] resourceEvent;
|
delete [] resourceEvent;
|
||||||
|
delete deniedReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,18 @@ ResourcePool::ResourcePool(InOrderCPU *_cpu, ThePipeline::Params *params)
|
||||||
0, _cpu, params));
|
0, _cpu, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResourcePool::~ResourcePool()
|
||||||
|
{
|
||||||
|
cout << "Deleting resources ..." << endl;
|
||||||
|
|
||||||
|
for (int i=0; i < resources.size(); i++) {
|
||||||
|
DPRINTF(Resource, "Deleting resource: %s.\n", resources[i]->name());
|
||||||
|
|
||||||
|
delete resources[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ResourcePool::init()
|
ResourcePool::init()
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,7 +122,7 @@ class ResourcePool {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ResourcePool(InOrderCPU *_cpu, ThePipeline::Params *params);
|
ResourcePool(InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||||
virtual ~ResourcePool() {}
|
~ResourcePool();
|
||||||
|
|
||||||
std::string name();
|
std::string name();
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,6 @@ class CacheUnit : public Resource
|
||||||
public:
|
public:
|
||||||
CacheUnit(std::string res_name, int res_id, int res_width,
|
CacheUnit(std::string res_name, int res_id, int res_width,
|
||||||
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||||
virtual ~CacheUnit() {}
|
|
||||||
|
|
||||||
enum Command {
|
enum Command {
|
||||||
InitiateFetch,
|
InitiateFetch,
|
||||||
|
|
|
@ -52,7 +52,6 @@ class ExecutionUnit : public Resource {
|
||||||
public:
|
public:
|
||||||
ExecutionUnit(std::string res_name, int res_id, int res_width,
|
ExecutionUnit(std::string res_name, int res_id, int res_width,
|
||||||
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||||
virtual ~ExecutionUnit() {}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void regStats();
|
virtual void regStats();
|
||||||
|
|
|
@ -54,6 +54,11 @@ FetchSeqUnit::FetchSeqUnit(std::string res_name, int res_id, int res_width,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FetchSeqUnit::~FetchSeqUnit()
|
||||||
|
{
|
||||||
|
delete [] resourceEvent;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FetchSeqUnit::init()
|
FetchSeqUnit::init()
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,8 +54,8 @@ class FetchSeqUnit : public Resource {
|
||||||
public:
|
public:
|
||||||
FetchSeqUnit(std::string res_name, int res_id, int res_width,
|
FetchSeqUnit(std::string res_name, int res_id, int res_width,
|
||||||
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||||
virtual ~FetchSeqUnit() {}
|
virtual ~FetchSeqUnit();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void activateThread(ThreadID tid);
|
virtual void activateThread(ThreadID tid);
|
||||||
virtual void deactivateThread(ThreadID tid);
|
virtual void deactivateThread(ThreadID tid);
|
||||||
|
|
|
@ -57,7 +57,6 @@ class MultDivUnit : public Resource {
|
||||||
public:
|
public:
|
||||||
MultDivUnit(std::string res_name, int res_id, int res_width,
|
MultDivUnit(std::string res_name, int res_id, int res_width,
|
||||||
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||||
virtual ~MultDivUnit() {}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Override default Resource getSlot(). Will only getSlot if
|
/** Override default Resource getSlot(). Will only getSlot if
|
||||||
|
|
Loading…
Reference in a new issue