Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/52083 )

Change subject: cpu: Fix some style problems in the base CPU class.
......................................................................

cpu: Fix some style problems in the base CPU class.

Change-Id: I5c714245237056eebeaf5de1278e8d13557ac131
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52083
Reviewed-by: Giacomo Travaglini <[email protected]>
Maintainer: Giacomo Travaglini <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/cpu/base.cc
M src/cpu/base.hh
2 files changed, 54 insertions(+), 30 deletions(-)

Approvals:
  Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 0b7ef88..fa79394 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -97,10 +97,10 @@
     Counter temp = cpu->totalOps();

     if (_repeatEvent)
-      cpu->schedule(this, curTick() + _interval);
+        cpu->schedule(this, curTick() + _interval);

     if (cpu->switchedOut()) {
-      return;
+        return;
     }

 #ifndef NDEBUG
@@ -150,7 +150,7 @@
     cpuList.push_back(this);

     DPRINTF(SyscallVerbose, "Constructing CPU with id %d, socket id %d\n",
-                _cpuId, _socketId);
+            _cpuId, _socketId);

     if (numThreads > maxThreadsPerCPU)
         maxThreadsPerCPU = numThreads;
@@ -196,7 +196,7 @@
     interrupts[tid]->post(int_num, index);
     // Only wake up syscall emulation if it is not waiting on a futex.
     // This is to model the fact that instructions such as ARM SEV
-    // should wake up a WFE sleep, but not a futex syscall WAIT. */
+    // should wake up a WFE sleep, but not a futex syscall WAIT.
     if (FullSystem || !system->futexMap.is_waiting(threadContexts[tid]))
         wakeup(tid);
 }
@@ -210,7 +210,7 @@
     monitor.armed = true;
     monitor.vAddr = address;
     monitor.pAddr = 0x0;
-    DPRINTF(Mwait,"[tid:%d] Armed monitor (vAddr=0x%lx)\n", tid, address);
+    DPRINTF(Mwait, "[tid:%d] Armed monitor (vAddr=0x%lx)\n", tid, address);
 }

 bool
@@ -227,7 +227,7 @@
         monitor.pAddr = pkt->getAddr() & mask;
         monitor.waiting = true;

-        DPRINTF(Mwait,"[tid:%d] mwait called (vAddr=0x%lx, "
+        DPRINTF(Mwait, "[tid:%d] mwait called (vAddr=0x%lx, "
"line's paddr=0x%lx)\n", tid, monitor.vAddr, monitor.pAddr);
         return true;
     } else {
@@ -264,7 +264,7 @@
     monitor.pAddr = req->getPaddr() & mask;
     monitor.waiting = true;

- DPRINTF(Mwait,"[tid:%d] mwait called (vAddr=0x%lx, line's paddr=0x%lx)\n", + DPRINTF(Mwait, "[tid:%d] mwait called (vAddr=0x%lx, line's paddr=0x%lx)\n",
             tid, monitor.vAddr, monitor.pAddr);
 }

@@ -679,17 +679,20 @@
     return threadContexts[tid]->getCurrentInstCount();
 }

-AddressMonitor::AddressMonitor() {
+AddressMonitor::AddressMonitor()
+{
     armed = false;
     waiting = false;
     gotWakeup = false;
 }

-bool AddressMonitor::doMonitor(PacketPtr pkt) {
+bool
+AddressMonitor::doMonitor(PacketPtr pkt)
+{
     assert(pkt->req->hasPaddr());
     if (armed && waiting) {
         if (pAddr == pkt->getAddr()) {
-            DPRINTF(Mwait,"pAddr=0x%lx invalidated: waking up core\n",
+            DPRINTF(Mwait, "pAddr=0x%lx invalidated: waking up core\n",
                     pkt->getAddr());
             waiting = false;
             return true;
diff --git a/src/cpu/base.hh b/src/cpu/base.hh
index 8a95f70..1ac174e 100644
--- a/src/cpu/base.hh
+++ b/src/cpu/base.hh
@@ -52,6 +52,7 @@
 #else
 #include "arch/generic/interrupts.hh"
 #include "base/statistics.hh"
+#include "debug/Mwait.hh"
 #include "mem/port_proxy.hh"
 #include "sim/clocked_object.hh"
 #include "sim/eventq.hh"
@@ -60,7 +61,6 @@
 #include "sim/probe/pmu.hh"
 #include "sim/probe/probe.hh"
 #include "sim/system.hh"
-#include "debug/Mwait.hh"

 namespace gem5
 {
@@ -237,8 +237,7 @@

     virtual void wakeup(ThreadID tid) = 0;

-    void
-    postInterrupt(ThreadID tid, int int_num, int index);
+    void postInterrupt(ThreadID tid, int int_num, int index);

     void
     clearInterrupt(ThreadID tid, int int_num, int index)
@@ -283,20 +282,25 @@
     /// Notify the CPU that the indicated context is now halted.
     virtual void haltContext(ThreadID thread_num);

-   /// Given a Thread Context pointer return the thread num
-   int findContext(ThreadContext *tc);
+    /// Given a Thread Context pointer return the thread num
+    int findContext(ThreadContext *tc);

-   /// Given a thread num get tho thread context for it
-   virtual ThreadContext *getContext(int tn) { return threadContexts[tn]; }
+    /// Given a thread num get tho thread context for it
+ virtual ThreadContext *getContext(int tn) { return threadContexts[tn]; }

-   /// Get the number of thread contexts available
-   unsigned numContexts() {
-       return static_cast<unsigned>(threadContexts.size());
-   }
+    /// Get the number of thread contexts available
+    unsigned
+    numContexts()
+    {
+        return static_cast<unsigned>(threadContexts.size());
+    }

     /// Convert ContextID to threadID
-    ThreadID contextToThread(ContextID cid)
-    { return static_cast<ThreadID>(cid - threadContexts[0]->contextId()); }
+    ThreadID
+    contextToThread(ContextID cid)
+    {
+        return static_cast<ThreadID>(cid - threadContexts[0]->contextId());
+    }

   public:
     PARAMS(BaseCPU);
@@ -520,7 +524,8 @@
     CPUState previousState;

     /** base method keeping track of cycle progression **/
-    inline void updateCycleCounters(CPUState state)
+    inline void
+    updateCycleCounters(CPUState state)
     {
         uint32_t delta = curCycle() - previousCycle;

@@ -528,8 +533,7 @@
             ppActiveCycles->notify(delta);
         }

-        switch (state)
-        {
+        switch (state) {
           case CPU_STATE_WAKEUP:
             ppSleeping->notify(false);
             break;
@@ -560,14 +564,16 @@
     static std::vector<BaseCPU *> cpuList;   //!< Static global cpu list

   public:
-    void traceFunctions(Addr pc)
+    void
+    traceFunctions(Addr pc)
     {
         if (functionTracingEnabled)
             traceFunctionsInternal(pc);
     }

     static int numSimulatedCPUs() { return cpuList.size(); }
-    static Counter numSimulatedInsts()
+    static Counter
+    numSimulatedInsts()
     {
         Counter total = 0;

@@ -578,7 +584,8 @@
         return total;
     }

-    static Counter numSimulatedOps()
+    static Counter
+    numSimulatedOps()
     {
         Counter total = 0;

@@ -606,7 +613,8 @@
     void armMonitor(ThreadID tid, Addr address);
     bool mwait(ThreadID tid, PacketPtr pkt);
     void mwaitAtomic(ThreadID tid, ThreadContext *tc, BaseMMU *mmu);
-    AddressMonitor *getCpuAddrMonitor(ThreadID tid)
+    AddressMonitor *
+    getCpuAddrMonitor(ThreadID tid)
     {
         assert(tid < numThreads);
         return &addressMonitor[tid];

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/52083
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I5c714245237056eebeaf5de1278e8d13557ac131
Gerrit-Change-Number: 52083
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to