changeset 50668b97c086 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=50668b97c086
description:
inorder-resources: delete events
make sure unrecognized events in the resource pool are deleted and also
delete resource events in destructor
diffstat:
4 files changed, 54 insertions(+), 29 deletions(-)
src/cpu/inorder/resource.cc | 6 +++
src/cpu/inorder/resource.hh | 3 +
src/cpu/inorder/resource_pool.cc | 66 +++++++++++++++++++++-----------------
src/cpu/inorder/resource_pool.hh | 8 ++++
diffs (160 lines):
diff -r 6cd5f0282d8a -r 50668b97c086 src/cpu/inorder/resource.cc
--- a/src/cpu/inorder/resource.cc Tue May 12 15:01:16 2009 -0400
+++ b/src/cpu/inorder/resource.cc Tue May 12 15:01:16 2009 -0400
@@ -44,6 +44,12 @@
deniedReq = new ResourceRequest(this, NULL, 0, 0, 0, 0);
}
+Resource::~Resource()
+{
+ delete [] resourceEvent;
+}
+
+
void
Resource::init()
{
diff -r 6cd5f0282d8a -r 50668b97c086 src/cpu/inorder/resource.hh
--- a/src/cpu/inorder/resource.hh Tue May 12 15:01:16 2009 -0400
+++ b/src/cpu/inorder/resource.hh Tue May 12 15:01:16 2009 -0400
@@ -60,7 +60,8 @@
public:
Resource(std::string res_name, int res_id, int res_width,
int res_latency, InOrderCPU *_cpu);
- virtual ~Resource() {}
+ virtual ~Resource();
+
/** Return name of this resource */
virtual std::string name();
diff -r 6cd5f0282d8a -r 50668b97c086 src/cpu/inorder/resource_pool.cc
--- a/src/cpu/inorder/resource_pool.cc Tue May 12 15:01:16 2009 -0400
+++ b/src/cpu/inorder/resource_pool.cc Tue May 12 15:01:16 2009 -0400
@@ -187,19 +187,18 @@
{
assert(delay >= 0);
- ResPoolEvent *res_pool_event = new ResPoolEvent(this);
-
switch (e_type)
{
case InOrderCPU::ActivateThread:
{
DPRINTF(Resource, "Scheduling Activate Thread Resource Pool Event
for tick %i.\n",
curTick + delay);
- res_pool_event->setEvent(e_type,
- inst,
- inst->squashingStage,
- inst->bdelaySeqNum,
- inst->readTid());
+ ResPoolEvent *res_pool_event = new ResPoolEvent(this,
+ e_type,
+ inst,
+
inst->squashingStage,
+ inst->bdelaySeqNum,
+ inst->readTid());
mainEventQueue.schedule(res_pool_event, curTick +
cpu->ticks(delay));
}
break;
@@ -207,14 +206,15 @@
case InOrderCPU::SuspendThread:
case InOrderCPU::DeallocateThread:
{
+
DPRINTF(Resource, "Scheduling Deactivate Thread Resource Pool
Event for tick %i.\n",
curTick + delay);
-
- res_pool_event->setEvent(e_type,
- inst,
- inst->squashingStage,
- inst->bdelaySeqNum,
- tid);
+ ResPoolEvent *res_pool_event = new ResPoolEvent(this,
+ e_type,
+ inst,
+
inst->squashingStage,
+ inst->bdelaySeqNum,
+ tid);
mainEventQueue.schedule(res_pool_event, curTick +
cpu->ticks(delay));
@@ -225,12 +225,11 @@
{
DPRINTF(Resource, "Scheduling Inst-Graduated Resource Pool Event
for tick %i.\n",
curTick + delay);
-
- res_pool_event->setEvent(e_type,
- inst,
- inst->squashingStage,
- inst->seqNum,
- inst->readTid());
+ ResPoolEvent *res_pool_event = new ResPoolEvent(this,e_type,
+ inst,
+
inst->squashingStage,
+ inst->seqNum,
+ inst->readTid());
mainEventQueue.schedule(res_pool_event, curTick +
cpu->ticks(delay));
}
@@ -240,13 +239,12 @@
{
DPRINTF(Resource, "Scheduling Squash Resource Pool Event for tick
%i.\n",
curTick + delay);
- res_pool_event->setEvent(e_type,
- inst,
- inst->squashingStage,
- inst->bdelaySeqNum,
- inst->readTid());
+ ResPoolEvent *res_pool_event = new ResPoolEvent(this,e_type,
+ inst,
+
inst->squashingStage,
+ inst->bdelaySeqNum,
+ inst->readTid());
mainEventQueue.schedule(res_pool_event, curTick +
cpu->ticks(delay));
-
}
break;
@@ -315,9 +313,21 @@
}
ResourcePool::ResPoolEvent::ResPoolEvent(ResourcePool *_resPool)
- : Event(CPU_Tick_Pri),
- resPool(_resPool)
-{ eventType = (InOrderCPU::CPUEventType) Default; }
+ : Event(CPU_Tick_Pri), resPool(_resPool),
+ eventType((InOrderCPU::CPUEventType) Default)
+{ }
+
+ResourcePool::ResPoolEvent::ResPoolEvent(ResourcePool *_resPool,
+ InOrderCPU::CPUEventType e_type,
+ DynInstPtr _inst,
+ int stage_num,
+ InstSeqNum seq_num,
+ unsigned _tid)
+ : Event(CPU_Tick_Pri), resPool(_resPool),
+ eventType(e_type), inst(_inst), seqNum(seq_num),
+ stageNum(stage_num), tid(_tid)
+{ }
+
void
ResourcePool::ResPoolEvent::process()
diff -r 6cd5f0282d8a -r 50668b97c086 src/cpu/inorder/resource_pool.hh
--- a/src/cpu/inorder/resource_pool.hh Tue May 12 15:01:16 2009 -0400
+++ b/src/cpu/inorder/resource_pool.hh Tue May 12 15:01:16 2009 -0400
@@ -87,6 +87,14 @@
/** Constructs a resource event. */
ResPoolEvent(ResourcePool *_resPool);
+ /** Constructs a resource event. */
+ ResPoolEvent(ResourcePool *_resPool,
+ InOrderCPU::CPUEventType e_type,
+ DynInstPtr _inst,
+ int stage_num,
+ InstSeqNum seq_num,
+ unsigned _tid);
+
/** Set Type of Event To Be Scheduled */
void setEvent(InOrderCPU::CPUEventType e_type,
DynInstPtr _inst,
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev