changeset dd20a8139788 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=dd20a8139788
description:
        Thread: Use inherited baseCpu rather than cpu in SimpleThread

        This patch is a trivial simplification, removing the cpu pointer from
        SimpleThread and relying on the baseCpu pointer in ThreadState. The
        patch does not add or change any functionality, it merely cleans up
        the code.

diffstat:

 src/cpu/simple_thread.cc |  19 ++++++++++---------
 src/cpu/simple_thread.hh |   7 ++-----
 src/cpu/thread_state.hh  |   2 +-
 3 files changed, 13 insertions(+), 15 deletions(-)

diffs (122 lines):

diff -r 79592b2b1d55 -r dd20a8139788 src/cpu/simple_thread.cc
--- a/src/cpu/simple_thread.cc  Tue Jan 31 07:46:04 2012 -0800
+++ b/src/cpu/simple_thread.cc  Tue Jan 31 11:50:07 2012 -0500
@@ -67,7 +67,7 @@
                            TheISA::TLB *_itb, TheISA::TLB *_dtb,
                            bool use_kernel_stats)
     : ThreadState(_cpu, _thread_num),
-      cpu(_cpu), system(_sys), itb(_itb), dtb(_dtb)
+      system(_sys), itb(_itb), dtb(_dtb)
 
 {
     tc = new ProxyThreadContext<SimpleThread>(this);
@@ -76,7 +76,7 @@
 
     clearArchRegs();
 
-    if (cpu->params()->profile) {
+    if (baseCpu->params()->profile) {
         profile = new FunctionProfile(system->kernelSymtab);
         Callback *cb =
             new MakeCallback<SimpleThread,
@@ -97,7 +97,7 @@
 SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, Process *_process,
                            TheISA::TLB *_itb, TheISA::TLB *_dtb)
     : ThreadState(_cpu, _thread_num, _process),
-      cpu(_cpu), itb(_itb), dtb(_dtb)
+      itb(_itb), dtb(_dtb)
 {
     clearArchRegs();
     tc = new ProxyThreadContext<SimpleThread>(this);
@@ -196,7 +196,7 @@
     // 
     // Now must serialize all the ISA dependent state
     //
-    isa.serialize(cpu, os);
+    isa.serialize(baseCpu, os);
 }
 
 
@@ -212,14 +212,15 @@
     // 
     // Now must unserialize all the ISA dependent state
     //
-    isa.unserialize(cpu, cp, section);
+    isa.unserialize(baseCpu, cp, section);
 }
 
 #if FULL_SYSTEM
 void
 SimpleThread::dumpFuncProfile()
 {
-    std::ostream *os = simout.create(csprintf("profile.%s.dat", cpu->name()));
+    std::ostream *os = simout.create(csprintf("profile.%s.dat",
+                                              baseCpu->name()));
     profile->dump(tc, *os);
 }
 #endif
@@ -240,7 +241,7 @@
     _status = ThreadContext::Active;
 
     // status() == Suspended
-    cpu->activateContext(_threadId, delay);
+    baseCpu->activateContext(_threadId, delay);
 }
 
 void
@@ -261,7 +262,7 @@
 #endif
 */
     _status = ThreadContext::Suspended;
-    cpu->suspendContext(_threadId);
+    baseCpu->suspendContext(_threadId);
 }
 
 
@@ -272,7 +273,7 @@
         return;
 
     _status = ThreadContext::Halted;
-    cpu->haltContext(_threadId);
+    baseCpu->haltContext(_threadId);
 }
 
 
diff -r 79592b2b1d55 -r dd20a8139788 src/cpu/simple_thread.hh
--- a/src/cpu/simple_thread.hh  Tue Jan 31 07:46:04 2012 -0800
+++ b/src/cpu/simple_thread.hh  Tue Jan 31 11:50:07 2012 -0500
@@ -127,12 +127,9 @@
   public:
     std::string name() const
     {
-        return csprintf("%s.[tid:%i]", cpu->name(), tc->threadId());
+        return csprintf("%s.[tid:%i]", baseCpu->name(), tc->threadId());
     }
 
-    // pointer to CPU associated with this SimpleThread
-    BaseCPU *cpu;
-
     ProxyThreadContext<SimpleThread> *tc;
 
     System *system;
@@ -207,7 +204,7 @@
      * ThreadContext interface functions.
      ******************************************/
 
-    BaseCPU *getCpuPtr() { return cpu; }
+    BaseCPU *getCpuPtr() { return baseCpu; }
 
     TheISA::TLB *getITBPtr() { return itb; }
 
diff -r 79592b2b1d55 -r dd20a8139788 src/cpu/thread_state.hh
--- a/src/cpu/thread_state.hh   Tue Jan 31 07:46:04 2012 -0800
+++ b/src/cpu/thread_state.hh   Tue Jan 31 11:50:07 2012 -0500
@@ -73,7 +73,7 @@
     ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process);
 #endif
 
-    ~ThreadState();
+    virtual ~ThreadState();
 
     void serialize(std::ostream &os);
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to