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

Change subject: cpu, gpu-compute: Replace EventWrapper use with EventFunctionWrapper
......................................................................

cpu, gpu-compute: Replace EventWrapper use with EventFunctionWrapper

Change-Id: Idd5992463bcf9154f823b82461070d1f1842cea3
Signed-off-by: Sean Wilson <spwils...@wisc.edu>
---
M src/cpu/base.cc
M src/cpu/kvm/base.cc
M src/cpu/o3/probe/elastic_trace.cc
M src/cpu/o3/probe/elastic_trace.hh
M src/cpu/simple/timing.cc
M src/cpu/simple/timing.hh
M src/cpu/testers/memtest/memtest.cc
M src/cpu/testers/memtest/memtest.hh
M src/cpu/testers/traffic_gen/traffic_gen.cc
M src/cpu/testers/traffic_gen/traffic_gen.hh
M src/cpu/trace/trace_cpu.cc
M src/cpu/trace/trace_cpu.hh
M src/gpu-compute/gpu_tlb.cc
M src/gpu-compute/gpu_tlb.hh
14 files changed, 29 insertions(+), 29 deletions(-)



diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 08f95ea..6f460d3 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -229,8 +229,8 @@
         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);
         }
     }
diff --git a/src/cpu/kvm/base.cc b/src/cpu/kvm/base.cc
index 6ae3c7d..23a4080 100644
--- a/src/cpu/kvm/base.cc
+++ b/src/cpu/kvm/base.cc
@@ -164,8 +164,7 @@
     thread->startup();

     Event *startupEvent(
-        new EventWrapper<BaseKvmCPU,
-                         &BaseKvmCPU::startupThread>(this, true));
+ new EventFunctionWrapper([this]{ startupThread(); }, name(), true));
     schedule(startupEvent, curTick());
 }

diff --git a/src/cpu/o3/probe/elastic_trace.cc b/src/cpu/o3/probe/elastic_trace.cc
index bf6b6f0..c97bf78 100644
--- a/src/cpu/o3/probe/elastic_trace.cc
+++ b/src/cpu/o3/probe/elastic_trace.cc
@@ -50,7 +50,7 @@

 ElasticTrace::ElasticTrace(const ElasticTraceParams* params)
     :  ProbeListenerObject(params),
-       regEtraceListenersEvent(this),
+       regEtraceListenersEvent([this]{ regEtraceListeners(); }, name()),
        firstWin(true),
        lastClearedSeqNum(0),
        depWindowSize(params->depWindowSize),
diff --git a/src/cpu/o3/probe/elastic_trace.hh b/src/cpu/o3/probe/elastic_trace.hh
index 584cdf1..08e02da 100644
--- a/src/cpu/o3/probe/elastic_trace.hh
+++ b/src/cpu/o3/probe/elastic_trace.hh
@@ -182,8 +182,7 @@
     void regStats();

     /** Event to trigger registering this listener for all probe points. */
-    EventWrapper<ElasticTrace,
- &ElasticTrace::regEtraceListeners> regEtraceListenersEvent;
+    EventFunctionWrapper regEtraceListenersEvent;

   private:
     /**
diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc
index 1c468dc..d2cb6ee 100644
--- a/src/cpu/simple/timing.cc
+++ b/src/cpu/simple/timing.cc
@@ -80,7 +80,7 @@
 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;
 }
diff --git a/src/cpu/simple/timing.hh b/src/cpu/simple/timing.hh
index eebf884..8498630 100644
--- a/src/cpu/simple/timing.hh
+++ b/src/cpu/simple/timing.hh
@@ -159,7 +159,8 @@
       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 @@
             void schedule(PacketPtr _pkt, Tick t);
         };

- EventWrapper<MasterPort, &MasterPort::sendRetryResp> retryRespEvent;
+        EventFunctionWrapper retryRespEvent;
     };

     class IcachePort : public TimingCPUPort
@@ -315,8 +316,7 @@

   private:

- typedef EventWrapper<TimingSimpleCPU, &TimingSimpleCPU::fetch> FetchEvent;
-    FetchEvent fetchEvent;
+    EventFunctionWrapper fetchEvent;

     struct IprEvent : Event {
         Packet *pkt;
diff --git a/src/cpu/testers/memtest/memtest.cc b/src/cpu/testers/memtest/memtest.cc
index 46387fa..6f3f9b3 100644
--- a/src/cpu/testers/memtest/memtest.cc
+++ b/src/cpu/testers/memtest/memtest.cc
@@ -86,9 +86,9 @@

 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),
diff --git a/src/cpu/testers/memtest/memtest.hh b/src/cpu/testers/memtest/memtest.hh
index daed5e5..023b878 100644
--- a/src/cpu/testers/memtest/memtest.hh
+++ b/src/cpu/testers/memtest/memtest.hh
@@ -84,15 +84,15 @@

     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
     {
diff --git a/src/cpu/testers/traffic_gen/traffic_gen.cc b/src/cpu/testers/traffic_gen/traffic_gen.cc
index 1a12b76..9d87329 100644
--- a/src/cpu/testers/traffic_gen/traffic_gen.cc
+++ b/src/cpu/testers/traffic_gen/traffic_gen.cc
@@ -61,14 +61,14 @@
       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)
 {
 }
diff --git a/src/cpu/testers/traffic_gen/traffic_gen.hh b/src/cpu/testers/traffic_gen/traffic_gen.hh
index 6b3ccbe..b2039be 100644
--- a/src/cpu/testers/traffic_gen/traffic_gen.hh
+++ b/src/cpu/testers/traffic_gen/traffic_gen.hh
@@ -152,7 +152,7 @@
     /**
      * 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 @@
     Tick retryPktTick;

     /** Event for scheduling updates */
-    EventWrapper<TrafficGen, &TrafficGen::update> updateEvent;
+    EventFunctionWrapper updateEvent;

     uint64_t numSuppressed;

diff --git a/src/cpu/trace/trace_cpu.cc b/src/cpu/trace/trace_cpu.cc
index 7b59b49..824c125 100644
--- a/src/cpu/trace/trace_cpu.cc
+++ b/src/cpu/trace/trace_cpu.cc
@@ -57,8 +57,8 @@
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),
diff --git a/src/cpu/trace/trace_cpu.hh b/src/cpu/trace/trace_cpu.hh
index 07c739c..c873a34 100644
--- a/src/cpu/trace/trace_cpu.hh
+++ b/src/cpu/trace/trace_cpu.hh
@@ -1082,10 +1082,10 @@
     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();
diff --git a/src/gpu-compute/gpu_tlb.cc b/src/gpu-compute/gpu_tlb.cc
index 1f1a4cc..b5411f8 100644
--- a/src/gpu-compute/gpu_tlb.cc
+++ b/src/gpu-compute/gpu_tlb.cc
@@ -61,7 +61,9 @@

     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);
diff --git a/src/gpu-compute/gpu_tlb.hh b/src/gpu-compute/gpu_tlb.hh
index 7a7485c..ee43752 100644
--- a/src/gpu-compute/gpu_tlb.hh
+++ b/src/gpu-compute/gpu_tlb.hh
@@ -425,7 +425,7 @@
         // 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 @@
         // Called at the end of simulation to dump page access stats.
         void exitCallback();

-        EventWrapper<GpuTLB, &GpuTLB::exitCallback> exitEvent;
+        EventFunctionWrapper exitEvent;
     };
 }


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

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd5992463bcf9154f823b82461070d1f1842cea3
Gerrit-Change-Number: 3746
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