summaryrefslogtreecommitdiff
path: root/src/cpu/inorder
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2010-01-31 18:30:08 -0500
committerKorey Sewell <ksewell@umich.edu>2010-01-31 18:30:08 -0500
commitf3bc2df663cccd7db7a4ba87acfc2d0137a5ca02 (patch)
tree90b4d7f42d47b85f899e2283b5c661f4b5f0256d /src/cpu/inorder
parent1a89e8f4cbab3b3a6fd144d3d08dfeaac203f945 (diff)
downloadgem5-f3bc2df663cccd7db7a4ba87acfc2d0137a5ca02.tar.xz
inorder: object cleanup in destructors
Diffstat (limited to 'src/cpu/inorder')
-rw-r--r--src/cpu/inorder/cpu.cc5
-rw-r--r--src/cpu/inorder/cpu.hh4
-rw-r--r--src/cpu/inorder/resource.cc1
-rw-r--r--src/cpu/inorder/resource_pool.cc12
-rw-r--r--src/cpu/inorder/resource_pool.hh2
-rw-r--r--src/cpu/inorder/resources/cache_unit.hh1
-rw-r--r--src/cpu/inorder/resources/execution_unit.hh1
-rw-r--r--src/cpu/inorder/resources/fetch_seq_unit.cc5
-rw-r--r--src/cpu/inorder/resources/fetch_seq_unit.hh4
-rw-r--r--src/cpu/inorder/resources/mult_div_unit.hh1
10 files changed, 29 insertions, 7 deletions
diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc
index 472317362..a3b203559 100644
--- a/src/cpu/inorder/cpu.cc
+++ b/src/cpu/inorder/cpu.cc
@@ -347,6 +347,11 @@ InOrderCPU::InOrderCPU(Params *params)
scheduleTickEvent(0);
}
+InOrderCPU::~InOrderCPU()
+{
+ delete resPool;
+}
+
void
InOrderCPU::regStats()
diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh
index dc0164d8f..d8424397b 100644
--- a/src/cpu/inorder/cpu.hh
+++ b/src/cpu/inorder/cpu.hh
@@ -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;
diff --git a/src/cpu/inorder/resource.cc b/src/cpu/inorder/resource.cc
index 1fd28c939..e5fd4f70e 100644
--- a/src/cpu/inorder/resource.cc
+++ b/src/cpu/inorder/resource.cc
@@ -47,6 +47,7 @@ Resource::Resource(string res_name, int res_id, int res_width,
Resource::~Resource()
{
delete [] resourceEvent;
+ delete deniedReq;
}
diff --git a/src/cpu/inorder/resource_pool.cc b/src/cpu/inorder/resource_pool.cc
index dd51242a3..1f15a2c96 100644
--- a/src/cpu/inorder/resource_pool.cc
+++ b/src/cpu/inorder/resource_pool.cc
@@ -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()
{
diff --git a/src/cpu/inorder/resource_pool.hh b/src/cpu/inorder/resource_pool.hh
index f61fae4c8..ce7167b87 100644
--- a/src/cpu/inorder/resource_pool.hh
+++ b/src/cpu/inorder/resource_pool.hh
@@ -122,7 +122,7 @@ class ResourcePool {
public:
ResourcePool(InOrderCPU *_cpu, ThePipeline::Params *params);
- virtual ~ResourcePool() {}
+ ~ResourcePool();
std::string name();
diff --git a/src/cpu/inorder/resources/cache_unit.hh b/src/cpu/inorder/resources/cache_unit.hh
index 4162102c7..50cb47519 100644
--- a/src/cpu/inorder/resources/cache_unit.hh
+++ b/src/cpu/inorder/resources/cache_unit.hh
@@ -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,
diff --git a/src/cpu/inorder/resources/execution_unit.hh b/src/cpu/inorder/resources/execution_unit.hh
index 37651e873..b9cf1d428 100644
--- a/src/cpu/inorder/resources/execution_unit.hh
+++ b/src/cpu/inorder/resources/execution_unit.hh
@@ -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();
diff --git a/src/cpu/inorder/resources/fetch_seq_unit.cc b/src/cpu/inorder/resources/fetch_seq_unit.cc
index ba86a91f0..03663881c 100644
--- a/src/cpu/inorder/resources/fetch_seq_unit.cc
+++ b/src/cpu/inorder/resources/fetch_seq_unit.cc
@@ -54,6 +54,11 @@ FetchSeqUnit::FetchSeqUnit(std::string res_name, int res_id, int res_width,
}
}
+FetchSeqUnit::~FetchSeqUnit()
+{
+ delete [] resourceEvent;
+}
+
void
FetchSeqUnit::init()
{
diff --git a/src/cpu/inorder/resources/fetch_seq_unit.hh b/src/cpu/inorder/resources/fetch_seq_unit.hh
index 3283e0330..289e150aa 100644
--- a/src/cpu/inorder/resources/fetch_seq_unit.hh
+++ b/src/cpu/inorder/resources/fetch_seq_unit.hh
@@ -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);
diff --git a/src/cpu/inorder/resources/mult_div_unit.hh b/src/cpu/inorder/resources/mult_div_unit.hh
index d3dd0260d..19688b09f 100644
--- a/src/cpu/inorder/resources/mult_div_unit.hh
+++ b/src/cpu/inorder/resources/mult_div_unit.hh
@@ -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