summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
authorSean Wilson <spwilson2@wisc.edu>2017-06-13 12:26:25 -0500
committerSean Wilson <spwilson2@wisc.edu>2017-06-20 18:03:21 +0000
commitd0b477475135f7d216fcdfa5a2c22266234801bc (patch)
tree11b71b5cd3b7633a6e772f66f89c0ab93cc594db /src/mem
parente34924b50fd3362dc51a67c51c6d7f2b2015cf30 (diff)
downloadgem5-d0b477475135f7d216fcdfa5a2c22266234801bc.tar.xz
mem: Replace EventWrapper in PacketQueue with EventFunctionWrapper
In order to replicate the same `name()` output with `PacketQueue`, subclasses using EventFunctionWrapper must initialize PacketQueue with their own name so the sendEvent holds the name of the subclass. Change-Id: Ib091e118bab8858192e1d1370d61def42958ec29 Signed-off-by: Sean Wilson <spwilson2@wisc.edu> Reviewed-on: https://gem5-review.googlesource.com/3744 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/packet_queue.cc13
-rw-r--r--src/mem/packet_queue.hh27
2 files changed, 32 insertions, 8 deletions
diff --git a/src/mem/packet_queue.cc b/src/mem/packet_queue.cc
index f7df3314f..7649fe5a6 100644
--- a/src/mem/packet_queue.cc
+++ b/src/mem/packet_queue.cc
@@ -50,8 +50,10 @@
using namespace std;
PacketQueue::PacketQueue(EventManager& _em, const std::string& _label,
+ const std::string& _sendEventName,
bool disable_sanity_check)
- : em(_em), sendEvent(this), _disableSanityCheck(disable_sanity_check),
+ : em(_em), sendEvent([this]{ processSendEvent(); }, _sendEventName),
+ _disableSanityCheck(disable_sanity_check),
label(_label), waitingOnRetry(false)
{
}
@@ -237,7 +239,8 @@ PacketQueue::drain()
ReqPacketQueue::ReqPacketQueue(EventManager& _em, MasterPort& _masterPort,
const std::string _label)
- : PacketQueue(_em, _label), masterPort(_masterPort)
+ : PacketQueue(_em, _label, name(_masterPort, _label)),
+ masterPort(_masterPort)
{
}
@@ -250,7 +253,8 @@ ReqPacketQueue::sendTiming(PacketPtr pkt)
SnoopRespPacketQueue::SnoopRespPacketQueue(EventManager& _em,
MasterPort& _masterPort,
const std::string _label)
- : PacketQueue(_em, _label), masterPort(_masterPort)
+ : PacketQueue(_em, _label, name(_masterPort, _label)),
+ masterPort(_masterPort)
{
}
@@ -262,7 +266,8 @@ SnoopRespPacketQueue::sendTiming(PacketPtr pkt)
RespPacketQueue::RespPacketQueue(EventManager& _em, SlavePort& _slavePort,
const std::string _label)
- : PacketQueue(_em, _label), slavePort(_slavePort)
+ : PacketQueue(_em, _label, name(_slavePort, _label)),
+ slavePort(_slavePort)
{
}
diff --git a/src/mem/packet_queue.hh b/src/mem/packet_queue.hh
index b1001e75d..f7379c900 100644
--- a/src/mem/packet_queue.hh
+++ b/src/mem/packet_queue.hh
@@ -87,7 +87,7 @@ class PacketQueue : public Drainable
void processSendEvent();
/** Event used to call processSendEvent. */
- EventWrapper<PacketQueue, &PacketQueue::processSendEvent> sendEvent;
+ EventFunctionWrapper sendEvent;
/*
* Optionally disable the sanity check
@@ -134,6 +134,7 @@ class PacketQueue : public Drainable
* on the size of the transmitList. The check is enabled by default.
*/
PacketQueue(EventManager& _em, const std::string& _label,
+ const std::string& _sendEventName,
bool disable_sanity_check = false);
/**
@@ -215,6 +216,12 @@ class ReqPacketQueue : public PacketQueue
MasterPort& masterPort;
+ // Static definition so it can be called when constructing the parent
+ // without us being completely initialized.
+ static const std::string name(const MasterPort& masterPort,
+ const std::string& label)
+ { return masterPort.name() + "-" + label; }
+
public:
/**
@@ -232,7 +239,7 @@ class ReqPacketQueue : public PacketQueue
virtual ~ReqPacketQueue() { }
const std::string name() const
- { return masterPort.name() + "-" + label; }
+ { return name(masterPort, label); }
bool sendTiming(PacketPtr pkt);
@@ -245,6 +252,12 @@ class SnoopRespPacketQueue : public PacketQueue
MasterPort& masterPort;
+ // Static definition so it can be called when constructing the parent
+ // without us being completely initialized.
+ static const std::string name(const MasterPort& masterPort,
+ const std::string& label)
+ { return masterPort.name() + "-" + label; }
+
public:
/**
@@ -262,7 +275,7 @@ class SnoopRespPacketQueue : public PacketQueue
virtual ~SnoopRespPacketQueue() { }
const std::string name() const
- { return masterPort.name() + "-" + label; }
+ { return name(masterPort, label); }
bool sendTiming(PacketPtr pkt);
@@ -275,6 +288,12 @@ class RespPacketQueue : public PacketQueue
SlavePort& slavePort;
+ // Static definition so it can be called when constructing the parent
+ // without us being completely initialized.
+ static const std::string name(const SlavePort& slavePort,
+ const std::string& label)
+ { return slavePort.name() + "-" + label; }
+
public:
/**
@@ -292,7 +311,7 @@ class RespPacketQueue : public PacketQueue
virtual ~RespPacketQueue() { }
const std::string name() const
- { return slavePort.name() + "-" + label; }
+ { return name(slavePort, label); }
bool sendTiming(PacketPtr pkt);