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);
|
||||
}
|
||||
|
||||
InOrderCPU::~InOrderCPU()
|
||||
{
|
||||
delete resPool;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InOrderCPU::regStats()
|
||||
|
|
|
@ -93,7 +93,9 @@ class InOrderCPU : public BaseCPU
|
|||
public:
|
||||
/** Constructs a CPU with the given parameters. */
|
||||
InOrderCPU(Params *params);
|
||||
|
||||
/* Destructor */
|
||||
~InOrderCPU();
|
||||
|
||||
/** CPU ID */
|
||||
int cpu_id;
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ Resource::Resource(string res_name, int res_id, int res_width,
|
|||
Resource::~Resource()
|
||||
{
|
||||
delete [] resourceEvent;
|
||||
delete deniedReq;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -91,6 +91,18 @@ ResourcePool::ResourcePool(InOrderCPU *_cpu, ThePipeline::Params *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
|
||||
ResourcePool::init()
|
||||
{
|
||||
|
|
|
@ -122,7 +122,7 @@ class ResourcePool {
|
|||
|
||||
public:
|
||||
ResourcePool(InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||
virtual ~ResourcePool() {}
|
||||
~ResourcePool();
|
||||
|
||||
std::string name();
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ class CacheUnit : public Resource
|
|||
public:
|
||||
CacheUnit(std::string res_name, int res_id, int res_width,
|
||||
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||
virtual ~CacheUnit() {}
|
||||
|
||||
enum Command {
|
||||
InitiateFetch,
|
||||
|
|
|
@ -52,7 +52,6 @@ class ExecutionUnit : public Resource {
|
|||
public:
|
||||
ExecutionUnit(std::string res_name, int res_id, int res_width,
|
||||
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||
virtual ~ExecutionUnit() {}
|
||||
|
||||
public:
|
||||
virtual void regStats();
|
||||
|
|
|
@ -54,6 +54,11 @@ FetchSeqUnit::FetchSeqUnit(std::string res_name, int res_id, int res_width,
|
|||
}
|
||||
}
|
||||
|
||||
FetchSeqUnit::~FetchSeqUnit()
|
||||
{
|
||||
delete [] resourceEvent;
|
||||
}
|
||||
|
||||
void
|
||||
FetchSeqUnit::init()
|
||||
{
|
||||
|
|
|
@ -54,8 +54,8 @@ class FetchSeqUnit : public Resource {
|
|||
public:
|
||||
FetchSeqUnit(std::string res_name, int res_id, int res_width,
|
||||
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||
virtual ~FetchSeqUnit() {}
|
||||
|
||||
virtual ~FetchSeqUnit();
|
||||
|
||||
virtual void init();
|
||||
virtual void activateThread(ThreadID tid);
|
||||
virtual void deactivateThread(ThreadID tid);
|
||||
|
|
|
@ -57,7 +57,6 @@ class MultDivUnit : public Resource {
|
|||
public:
|
||||
MultDivUnit(std::string res_name, int res_id, int res_width,
|
||||
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
|
||||
virtual ~MultDivUnit() {}
|
||||
|
||||
public:
|
||||
/** Override default Resource getSlot(). Will only getSlot if
|
||||
|
|
Loading…
Reference in a new issue