summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hanson@arm.com>2012-01-31 11:50:07 -0500
committerAndreas Hansson <andreas.hanson@arm.com>2012-01-31 11:50:07 -0500
commit4fdecae443c4f11d24b7da537b6f7a2baadbd130 (patch)
tree428e7864c689c6b28c854babd875424004dd2816
parent0ed3c84c7b05d7d3c9d5f0e3f1c05c20afef93b9 (diff)
downloadgem5-4fdecae443c4f11d24b7da537b6f7a2baadbd130.tar.xz
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.
-rw-r--r--src/cpu/simple_thread.cc19
-rw-r--r--src/cpu/simple_thread.hh7
-rw-r--r--src/cpu/thread_state.hh2
3 files changed, 13 insertions, 15 deletions
diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc
index 2541bdee1..8e7127269 100644
--- a/src/cpu/simple_thread.cc
+++ b/src/cpu/simple_thread.cc
@@ -67,7 +67,7 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
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 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
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, System *_sys,
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 @@ SimpleThread::serialize(ostream &os)
//
// Now must serialize all the ISA dependent state
//
- isa.serialize(cpu, os);
+ isa.serialize(baseCpu, os);
}
@@ -212,14 +212,15 @@ SimpleThread::unserialize(Checkpoint *cp, const std::string &section)
//
// 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 @@ SimpleThread::activate(int delay)
_status = ThreadContext::Active;
// status() == Suspended
- cpu->activateContext(_threadId, delay);
+ baseCpu->activateContext(_threadId, delay);
}
void
@@ -261,7 +262,7 @@ SimpleThread::suspend()
#endif
*/
_status = ThreadContext::Suspended;
- cpu->suspendContext(_threadId);
+ baseCpu->suspendContext(_threadId);
}
@@ -272,7 +273,7 @@ SimpleThread::halt()
return;
_status = ThreadContext::Halted;
- cpu->haltContext(_threadId);
+ baseCpu->haltContext(_threadId);
}
diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh
index b8dae5d01..46ed92ce8 100644
--- a/src/cpu/simple_thread.hh
+++ b/src/cpu/simple_thread.hh
@@ -127,12 +127,9 @@ class SimpleThread : public ThreadState
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 @@ class SimpleThread : public ThreadState
* ThreadContext interface functions.
******************************************/
- BaseCPU *getCpuPtr() { return cpu; }
+ BaseCPU *getCpuPtr() { return baseCpu; }
TheISA::TLB *getITBPtr() { return itb; }
diff --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh
index a007567c1..f14daaeb8 100644
--- a/src/cpu/thread_state.hh
+++ b/src/cpu/thread_state.hh
@@ -73,7 +73,7 @@ struct ThreadState {
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process);
#endif
- ~ThreadState();
+ virtual ~ThreadState();
void serialize(std::ostream &os);