From: Mitch Hayenga Date: Sat, 20 Sep 2014 21:18:36 +0000 (-0400) Subject: cpu: Remove unused deallocateContext calls X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc6523e2d686447f90acccac20c0fb2940dc3e3b;p=gem5.git cpu: Remove unused deallocateContext calls The call paths for de-scheduling a thread are halt() and suspend(), from the thread context. There is no call to deallocateContext() in general, though some CPUs chose to define it. This patch removes the function from BaseCPU and the cores which do not require it. --- diff --git a/src/cpu/base.hh b/src/cpu/base.hh index ac3d1d892..a124b4282 100644 --- a/src/cpu/base.hh +++ b/src/cpu/base.hh @@ -257,9 +257,6 @@ class BaseCPU : public MemObject /// Notify the CPU that the indicated context is now suspended. virtual void suspendContext(ThreadID thread_num) {} - /// Notify the CPU that the indicated context is now deallocated. - virtual void deallocateContext(ThreadID thread_num) {} - /// Notify the CPU that the indicated context is now halted. virtual void haltContext(ThreadID thread_num) {} diff --git a/src/cpu/inorder/inorder_dyn_inst.cc b/src/cpu/inorder/inorder_dyn_inst.cc index 08f583338..adde35fdf 100644 --- a/src/cpu/inorder/inorder_dyn_inst.cc +++ b/src/cpu/inorder/inorder_dyn_inst.cc @@ -571,12 +571,6 @@ InOrderDynInst::setRegOtherThread(int reg_idx, MiscReg val, ThreadID tid) } } -void -InOrderDynInst::deallocateContext(int thread_num) -{ - this->cpu->deallocateContext(thread_num); -} - Fault InOrderDynInst::readMem(Addr addr, uint8_t *data, unsigned size, unsigned flags) diff --git a/src/cpu/inorder/inorder_dyn_inst.hh b/src/cpu/inorder/inorder_dyn_inst.hh index 7558df7d1..053a72d1d 100644 --- a/src/cpu/inorder/inorder_dyn_inst.hh +++ b/src/cpu/inorder/inorder_dyn_inst.hh @@ -531,13 +531,6 @@ class InOrderDynInst : public ExecContext, public RefCounted /** Emulates a syscall. */ void syscall(int64_t callnum); - //////////////////////////////////////////////////////////// - // - // MULTITHREADING INTERFACE TO CPU MODELS - // - //////////////////////////////////////////////////////////// - virtual void deallocateContext(int thread_num); - //////////////////////////////////////////////////////////// // // PROGRAM COUNTERS - PC/NPC/NPC diff --git a/src/cpu/inorder/thread_context.hh b/src/cpu/inorder/thread_context.hh index e29b8f273..7b1dc833f 100644 --- a/src/cpu/inorder/thread_context.hh +++ b/src/cpu/inorder/thread_context.hh @@ -281,9 +281,6 @@ class InOrderThreadContext : public ThreadContext void activateContext() { cpu->activateContext(thread->threadId()); } - void deallocateContext() - { cpu->deallocateContext(thread->threadId()); } - /** Returns the number of consecutive store conditional failures. */ // @todo: Figure out where these store cond failures should go. unsigned readStCondFailures() diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index 2ae185532..7ed3944cf 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -728,22 +728,14 @@ FullO3CPU::activateContext(ThreadID tid) } } -template -void -FullO3CPU::deallocateContext(ThreadID tid, bool remove) -{ - deactivateThread(tid); - if (remove) - removeThread(tid); -} - template void FullO3CPU::suspendContext(ThreadID tid) { DPRINTF(O3CPU,"[tid: %i]: Suspending Thread Context.\n", tid); assert(!switchedOut()); - deallocateContext(tid, false); + + deactivateThread(tid); // If this was the last thread then unschedule the tick event. if (activeThreads.size() == 0) @@ -761,7 +753,9 @@ FullO3CPU::haltContext(ThreadID tid) //For now, this is the same as deallocate DPRINTF(O3CPU,"[tid:%i]: Halt Context called. Deallocating", tid); assert(!switchedOut()); - deallocateContext(tid, true); + + deactivateThread(tid); + removeThread(tid); } template diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh index 0fd08a68b..c263790ce 100644 --- a/src/cpu/o3/cpu.hh +++ b/src/cpu/o3/cpu.hh @@ -325,11 +325,6 @@ class FullO3CPU : public BaseO3CPU /** Remove Thread from Active Threads List */ void suspendContext(ThreadID tid); - /** Remove Thread from Active Threads List && - * Possibly Remove Thread Context from CPU. - */ - void deallocateContext(ThreadID tid, bool remove); - /** Remove Thread from Active Threads List && * Remove Thread Context from CPU. */ diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc index 5130e2960..6101ff30f 100644 --- a/src/cpu/simple/base.cc +++ b/src/cpu/simple/base.cc @@ -132,14 +132,6 @@ BaseSimpleCPU::~BaseSimpleCPU() { } -void -BaseSimpleCPU::deallocateContext(ThreadID thread_num) -{ - // for now, these are equivalent - suspendContext(thread_num); -} - - void BaseSimpleCPU::haltContext(ThreadID thread_num) { diff --git a/src/cpu/simple/base.hh b/src/cpu/simple/base.hh index 43d96fbeb..8f38a33c8 100644 --- a/src/cpu/simple/base.hh +++ b/src/cpu/simple/base.hh @@ -170,7 +170,6 @@ class BaseSimpleCPU : public BaseCPU, public ExecContext void postExecute(); void advancePC(const Fault &fault); - virtual void deallocateContext(ThreadID thread_num); virtual void haltContext(ThreadID thread_num); // statistics