cpu, gpu-compute: Replace EventWrapper use with EventFunctionWrapper
authorSean Wilson <spwilson2@wisc.edu>
Wed, 7 Jun 2017 17:13:16 +0000 (12:13 -0500)
committerSean Wilson <spwilson2@wisc.edu>
Tue, 20 Jun 2017 18:03:21 +0000 (18:03 +0000)
Change-Id: Idd5992463bcf9154f823b82461070d1f1842cea3
Signed-off-by: Sean Wilson <spwilson2@wisc.edu>
Reviewed-on: https://gem5-review.googlesource.com/3746
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

14 files changed:
src/cpu/base.cc
src/cpu/kvm/base.cc
src/cpu/o3/probe/elastic_trace.cc
src/cpu/o3/probe/elastic_trace.hh
src/cpu/simple/timing.cc
src/cpu/simple/timing.hh
src/cpu/testers/memtest/memtest.cc
src/cpu/testers/memtest/memtest.hh
src/cpu/testers/traffic_gen/traffic_gen.cc
src/cpu/testers/traffic_gen/traffic_gen.hh
src/cpu/trace/trace_cpu.cc
src/cpu/trace/trace_cpu.hh
src/gpu-compute/gpu_tlb.cc
src/gpu-compute/gpu_tlb.hh

index 08f95ea493f3f469805e7521ba7ec7f4b2ea77d0..6f460d3af29ce7a50587971b8d3973c7763fcc2e 100644 (file)
@@ -229,8 +229,8 @@ BaseCPU::BaseCPU(Params *p, bool is_checker)
         if (p->function_trace_start == 0) {
             functionTracingEnabled = true;
         } else {
-            typedef EventWrapper<BaseCPU, &BaseCPU::enableFunctionTrace> wrap;
-            Event *event = new wrap(this, true);
+            Event *event = new EventFunctionWrapper(
+                [this]{ enableFunctionTrace(); }, name(), true);
             schedule(event, p->function_trace_start);
         }
     }
index 6ae3c7dff9631a1e942ffa6595e4ec73d5d3237e..23a408084946bfb086adc708b8f9cadbd5cfa1f0 100644 (file)
@@ -164,8 +164,7 @@ BaseKvmCPU::startup()
     thread->startup();
 
     Event *startupEvent(
-        new EventWrapper<BaseKvmCPU,
-                         &BaseKvmCPU::startupThread>(this, true));
+        new EventFunctionWrapper([this]{ startupThread(); }, name(), true));
     schedule(startupEvent, curTick());
 }
 
index bf6b6f0024ac640e4395176eaf5b98fea7869900..c97bf787704870d58b94d1a3260005c90ab208fd 100644 (file)
@@ -50,7 +50,7 @@
 
 ElasticTrace::ElasticTrace(const ElasticTraceParams* params)
     :  ProbeListenerObject(params),
-       regEtraceListenersEvent(this),
+       regEtraceListenersEvent([this]{ regEtraceListeners(); }, name()),
        firstWin(true),
        lastClearedSeqNum(0),
        depWindowSize(params->depWindowSize),
index 584cdf18264939c853639aee2b3bf7569365d085..08e02daef47b2eb603069de3250fb9f6b98e9af4 100644 (file)
@@ -182,8 +182,7 @@ class ElasticTrace : public ProbeListenerObject
     void regStats();
 
     /** Event to trigger registering this listener for all probe points. */
-    EventWrapper<ElasticTrace,
-                 &ElasticTrace::regEtraceListeners> regEtraceListenersEvent;
+    EventFunctionWrapper regEtraceListenersEvent;
 
   private:
     /**
index 1c468dc99ff1db8e6bf123c5159d25005c28ebcc..d2cb6ee210132df2b05a7346b99fd729cfb7ca02 100644 (file)
@@ -80,7 +80,7 @@ TimingSimpleCPU::TimingCPUPort::TickEvent::schedule(PacketPtr _pkt, Tick t)
 TimingSimpleCPU::TimingSimpleCPU(TimingSimpleCPUParams *p)
     : BaseSimpleCPU(p), fetchTranslation(this), icachePort(this),
       dcachePort(this), ifetch_pkt(NULL), dcache_pkt(NULL), previousCycle(0),
-      fetchEvent(this)
+      fetchEvent([this]{ fetch(); }, name())
 {
     _status = Idle;
 }
index eebf884ca55edc4d9dd9dab789b7ce3f93c24083..8498630b4d1df975b81c2cc106238c755a45fc10 100644 (file)
@@ -159,7 +159,8 @@ class TimingSimpleCPU : public BaseSimpleCPU
       public:
 
         TimingCPUPort(const std::string& _name, TimingSimpleCPU* _cpu)
-            : MasterPort(_name, _cpu), cpu(_cpu), retryRespEvent(this)
+            : MasterPort(_name, _cpu), cpu(_cpu),
+              retryRespEvent([this]{ sendRetryResp(); }, name())
         { }
 
       protected:
@@ -176,7 +177,7 @@ class TimingSimpleCPU : public BaseSimpleCPU
             void schedule(PacketPtr _pkt, Tick t);
         };
 
-        EventWrapper<MasterPort, &MasterPort::sendRetryResp> retryRespEvent;
+        EventFunctionWrapper retryRespEvent;
     };
 
     class IcachePort : public TimingCPUPort
@@ -315,8 +316,7 @@ class TimingSimpleCPU : public BaseSimpleCPU
 
   private:
 
-    typedef EventWrapper<TimingSimpleCPU, &TimingSimpleCPU::fetch> FetchEvent;
-    FetchEvent fetchEvent;
+    EventFunctionWrapper fetchEvent;
 
     struct IprEvent : Event {
         Packet *pkt;
index 46387fa01c2342328d48b4b1d64880b5173fbe28..6f3f9b36fb96ad3effbbf4c65e6aa2c31fe3a338 100644 (file)
@@ -86,9 +86,9 @@ MemTest::sendPkt(PacketPtr pkt) {
 
 MemTest::MemTest(const Params *p)
     : MemObject(p),
-      tickEvent(this),
-      noRequestEvent(this),
-      noResponseEvent(this),
+      tickEvent([this]{ tick(); }, name()),
+      noRequestEvent([this]{ noRequest(); }, name()),
+      noResponseEvent([this]{ noResponse(); }, name()),
       port("port", *this),
       retryPkt(nullptr),
       size(p->size),
index daed5e5d2c20c3365b2132a61b116ba1d0699183..023b878c988248d8abc7d73229abebe0623b1be3 100644 (file)
@@ -84,15 +84,15 @@ class MemTest : public MemObject
 
     void tick();
 
-    EventWrapper<MemTest, &MemTest::tick> tickEvent;
+    EventFunctionWrapper tickEvent;
 
     void noRequest();
 
-    EventWrapper<MemTest, &MemTest::noRequest> noRequestEvent;
+    EventFunctionWrapper noRequestEvent;
 
     void noResponse();
 
-    EventWrapper<MemTest, &MemTest::noResponse> noResponseEvent;
+    EventFunctionWrapper noResponseEvent;
 
     class CpuPort : public MasterPort
     {
index 1a12b767581b921cd9a4291c862e5a69f940f3a7..9d8732902b74c44b8ef9f75425103e0775ee7b43 100644 (file)
@@ -61,14 +61,14 @@ TrafficGen::TrafficGen(const TrafficGenParams* p)
       configFile(p->config_file),
       elasticReq(p->elastic_req),
       progressCheck(p->progress_check),
-      noProgressEvent(this),
+      noProgressEvent([this]{ noProgress(); }, name()),
       nextTransitionTick(0),
       nextPacketTick(0),
       currState(0),
       port(name() + ".port", *this),
       retryPkt(NULL),
       retryPktTick(0),
-      updateEvent(this),
+      updateEvent([this]{ update(); }, name()),
       numSuppressed(0)
 {
 }
index 6b3ccbe30ed6db477672f33889137153b0745b5d..b2039bef9f2c83156681d6e57345526bd961416f 100644 (file)
@@ -152,7 +152,7 @@ class TrafficGen : public MemObject
     /**
      * Event to keep track of our progress, or lack thereof.
      */
-    EventWrapper<TrafficGen, &TrafficGen::noProgress> noProgressEvent;
+    EventFunctionWrapper noProgressEvent;
 
     /** Time of next transition */
     Tick nextTransitionTick;
@@ -206,7 +206,7 @@ class TrafficGen : public MemObject
     Tick retryPktTick;
 
     /** Event for scheduling updates */
-    EventWrapper<TrafficGen, &TrafficGen::update> updateEvent;
+    EventFunctionWrapper updateEvent;
 
     uint64_t numSuppressed;
 
index 7b59b49e07fc7ea424f93da8a3871e3ee8bfa36a..824c1258fb3fc06b36c93157b59c1ae6401399fa 100644 (file)
@@ -57,8 +57,8 @@ TraceCPU::TraceCPU(TraceCPUParams *params)
         icacheGen(*this, ".iside", icachePort, instMasterID, instTraceFile),
         dcacheGen(*this, ".dside", dcachePort, dataMasterID, dataTraceFile,
                   params),
-        icacheNextEvent(this),
-        dcacheNextEvent(this),
+        icacheNextEvent([this]{ schedIcacheNext(); }, name()),
+        dcacheNextEvent([this]{ schedDcacheNext(); }, name()),
         oneTraceComplete(false),
         traceOffset(0),
         execCompleteEvent(nullptr),
index 07c739c57085028f4e9db811a51c28981427af44..c873a349f0cfee7ffcd1655f05914bdd4b1576d3 100644 (file)
@@ -1082,10 +1082,10 @@ class TraceCPU : public BaseCPU
     void schedDcacheNext();
 
     /** Event for the control flow method schedIcacheNext() */
-    EventWrapper<TraceCPU, &TraceCPU::schedIcacheNext> icacheNextEvent;
+    EventFunctionWrapper icacheNextEvent;
 
     /** Event for the control flow method schedDcacheNext() */
-    EventWrapper<TraceCPU, &TraceCPU::schedDcacheNext> dcacheNextEvent;
+    EventFunctionWrapper dcacheNextEvent;
 
     /** This is called when either generator finishes executing from the trace */
     void checkAndSchedExitEvent();
index 1f1a4cc61dea7ae74de4b1f533e68d7233746727..b5411f82c01a3a0571408f652f245820384604ab 100644 (file)
@@ -61,7 +61,9 @@ namespace X86ISA
 
     GpuTLB::GpuTLB(const Params *p)
         : MemObject(p), configAddress(0), size(p->size),
-          cleanupEvent(this, false, Event::Maximum_Pri), exitEvent(this)
+          cleanupEvent([this]{ cleanup(); }, name(), false,
+                       Event::Maximum_Pri),
+          exitEvent([this]{ exitCallback(); }, name())
     {
         assoc = p->assoc;
         assert(assoc <= size);
index 7a7485c48d9f84fa8abf19244be7edb83ef7ba9f..ee4375259c378fb58b17742d5c3ec7618ae8f23d 100644 (file)
@@ -425,7 +425,7 @@ namespace X86ISA
         // free memory and do the required clean-up
         void cleanup();
 
-        EventWrapper<GpuTLB, &GpuTLB::cleanup> cleanupEvent;
+        EventFunctionWrapper cleanupEvent;
 
         /**
          * This hash map will use the virtual page address as a key
@@ -458,7 +458,7 @@ namespace X86ISA
         // Called at the end of simulation to dump page access stats.
         void exitCallback();
 
-        EventWrapper<GpuTLB, &GpuTLB::exitCallback> exitEvent;
+        EventFunctionWrapper exitEvent;
     };
 }