Sean Wilson has uploaded this change for review. ( https://gem5-review.googlesource.com/3744

Change subject: mem: Replace EventWrapper in PacketQueue with EventFunctionWrapper
......................................................................

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 <spwils...@wisc.edu>
---
M src/mem/packet_queue.cc
M src/mem/packet_queue.hh
2 files changed, 26 insertions(+), 8 deletions(-)



diff --git a/src/mem/packet_queue.cc b/src/mem/packet_queue.cc
index f7df331..7649fe5 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 @@

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

 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 b1001e7..5845f0b 100644
--- a/src/mem/packet_queue.hh
+++ b/src/mem/packet_queue.hh
@@ -87,7 +87,7 @@
     void processSendEvent();

     /** Event used to call processSendEvent. */
-    EventWrapper<PacketQueue, &PacketQueue::processSendEvent> sendEvent;
+    EventFunctionWrapper sendEvent;

      /*
       * Optionally disable the sanity check
@@ -134,6 +134,7 @@
* 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,10 @@

     MasterPort& masterPort;

+    static const std::string name(const MasterPort& masterPort,
+                                  const std::string& label)
+    { return masterPort.name() + "-" + label; }
+
   public:

     /**
@@ -232,7 +237,7 @@
     virtual ~ReqPacketQueue() { }

     const std::string name() const
-    { return masterPort.name() + "-" + label; }
+    { return name(masterPort, label); }

     bool sendTiming(PacketPtr pkt);

@@ -245,6 +250,10 @@

     MasterPort& masterPort;

+    static const std::string name(const MasterPort& masterPort,
+                                  const std::string& label)
+    { return masterPort.name() + "-" + label; }
+
   public:

     /**
@@ -262,7 +271,7 @@
     virtual ~SnoopRespPacketQueue() { }

     const std::string name() const
-    { return masterPort.name() + "-" + label; }
+    { return name(masterPort, label); }

     bool sendTiming(PacketPtr pkt);

@@ -275,6 +284,10 @@

     SlavePort& slavePort;

+    static const std::string name(const SlavePort& slavePort,
+                                  const std::string& label)
+    { return slavePort.name() + "-" + label; }
+
   public:

     /**
@@ -292,7 +305,7 @@
     virtual ~RespPacketQueue() { }

     const std::string name() const
-    { return slavePort.name() + "-" + label; }
+    { return name(slavePort, label); }

     bool sendTiming(PacketPtr pkt);


--
To view, visit https://gem5-review.googlesource.com/3744
To unsubscribe, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib091e118bab8858192e1d1370d61def42958ec29
Gerrit-Change-Number: 3744
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Wilson <spwils...@wisc.edu>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to