inorder: object cleanup in destructors

This commit is contained in:
Korey Sewell 2010-01-31 18:30:08 -05:00
parent 1a89e8f4cb
commit f3bc2df663
10 changed files with 29 additions and 7 deletions

View file

@ -347,6 +347,11 @@ InOrderCPU::InOrderCPU(Params *params)
scheduleTickEvent(0);
}
InOrderCPU::~InOrderCPU()
{
delete resPool;
}
void
InOrderCPU::regStats()

View file

@ -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;

View file

@ -47,6 +47,7 @@ Resource::Resource(string res_name, int res_id, int res_width,
Resource::~Resource()
{
delete [] resourceEvent;
delete deniedReq;
}

View file

@ -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()
{

View file

@ -122,7 +122,7 @@ class ResourcePool {
public:
ResourcePool(InOrderCPU *_cpu, ThePipeline::Params *params);
virtual ~ResourcePool() {}
~ResourcePool();
std::string name();

View file

@ -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,

View file

@ -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();

View file

@ -54,6 +54,11 @@ FetchSeqUnit::FetchSeqUnit(std::string res_name, int res_id, int res_width,
}
}
FetchSeqUnit::~FetchSeqUnit()
{
delete [] resourceEvent;
}
void
FetchSeqUnit::init()
{

View file

@ -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);

View file

@ -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