diff options
author | Gabe Black <gabeblack@google.com> | 2019-04-13 20:49:20 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-04-22 21:17:01 +0000 |
commit | 620d1c6f72733e87062a51c5f9d3e7fd6324f543 (patch) | |
tree | 9f744069e22a514b3c5991cfb04401425831e253 /src/cpu/simple_thread.cc | |
parent | 3a106e114a7008d13203af55dc54c02b34bd1069 (diff) | |
download | gem5-620d1c6f72733e87062a51c5f9d3e7fd6324f543.tar.xz |
cpu: Eliminate the ProxyThreadContext class.
Replace it with direct inheritance from the ThreadContext class in the
SimpleThread class which was the only place it was used.
Also take the opportunity to use some specialized types instead of
ints, etc., add some consts, and fix some style issues.
Change-Id: I5d2cfa87b20dc43615e33e6755c9d016564e9c0e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18048
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/cpu/simple_thread.cc')
-rw-r--r-- | src/cpu/simple_thread.cc | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc index c18bac2ef..7fee8ddc7 100644 --- a/src/cpu/simple_thread.cc +++ b/src/cpu/simple_thread.cc @@ -81,8 +81,7 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, itb(_itb), dtb(_dtb), decoder(TheISA::Decoder(_isa)) { clearArchRegs(); - tc = new ProxyThreadContext<SimpleThread>(this); - quiesceEvent = new EndQuiesceEvent(tc); + quiesceEvent = new EndQuiesceEvent(this); } SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, @@ -91,9 +90,7 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, : ThreadState(_cpu, _thread_num, NULL), isa(_isa), system(_sys), itb(_itb), dtb(_dtb), decoder(TheISA::Decoder(_isa)) { - tc = new ProxyThreadContext<SimpleThread>(this); - - quiesceEvent = new EndQuiesceEvent(tc); + quiesceEvent = new EndQuiesceEvent(this); clearArchRegs(); @@ -115,15 +112,10 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, kernelStats = new TheISA::Kernel::Statistics(); } -SimpleThread::~SimpleThread() -{ - delete tc; -} - void SimpleThread::takeOverFrom(ThreadContext *oldContext) { - ::takeOverFrom(*tc, *oldContext); + ::takeOverFrom(*this, *oldContext); decoder.takeOverFrom(oldContext->getDecoderPtr()); kernelStats = oldContext->getKernelStats(); @@ -148,7 +140,7 @@ void SimpleThread::serialize(CheckpointOut &cp) const { ThreadState::serialize(cp); - ::serialize(*tc, cp); + ::serialize(*this, cp); } @@ -156,20 +148,20 @@ void SimpleThread::unserialize(CheckpointIn &cp) { ThreadState::unserialize(cp); - ::unserialize(*tc, cp); + ::unserialize(*this, cp); } void SimpleThread::startup() { - isa->startup(tc); + isa->startup(this); } void SimpleThread::dumpFuncProfile() { OutputStream *os(simout.create(csprintf("profile.%s.dat", baseCpu->name()))); - profile->dump(tc, *os->stream()); + profile->dump(this, *os->stream()); simout.close(os); } @@ -218,7 +210,7 @@ SimpleThread::regStats(const string &name) void SimpleThread::copyArchRegs(ThreadContext *src_tc) { - TheISA::copyRegs(src_tc, tc); + TheISA::copyRegs(src_tc, this); } // The following methods are defined in src/arch/alpha/ev5.cc for |