From 8882dc1283771463a20194c083f4b8940a2d574b Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Wed, 15 Apr 2009 13:13:47 -0700 Subject: Get rid of the Unallocated thread context state. Basically merge it in with Halted. Also had to get rid of a few other functions that called ThreadContext::deallocate(), including: - InOrderCPU's setThreadRescheduleCondition. - ThreadContext::exit(). This function was there to avoid terminating simulation when one thread out of a multi-thread workload exits, but we need to find a better (non-cpu-centric) way. --- src/cpu/inorder/cpu.hh | 6 ------ src/cpu/inorder/inorder_dyn_inst.cc | 6 ------ src/cpu/inorder/inorder_dyn_inst.hh | 2 -- src/cpu/inorder/thread_context.cc | 15 +-------------- src/cpu/inorder/thread_context.hh | 29 ----------------------------- 5 files changed, 1 insertion(+), 57 deletions(-) (limited to 'src/cpu/inorder') diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh index f30ef128b..0545f4bf8 100644 --- a/src/cpu/inorder/cpu.hh +++ b/src/cpu/inorder/cpu.hh @@ -340,12 +340,6 @@ class InOrderCPU : public BaseCPU virtual void disableMultiThreading(unsigned tid, unsigned vpe); void disableThreads(unsigned tid, unsigned vpe); - // Sets a thread-rescheduling condition. - void setThreadRescheduleCondition(uint32_t tid) - { - //@TODO: IMPLEMENT ME - } - /** Activate a Thread When CPU Resources are Available. */ void activateWhenReady(int tid); diff --git a/src/cpu/inorder/inorder_dyn_inst.cc b/src/cpu/inorder/inorder_dyn_inst.cc index ceb3cbe51..7fc953da2 100644 --- a/src/cpu/inorder/inorder_dyn_inst.cc +++ b/src/cpu/inorder/inorder_dyn_inst.cc @@ -573,12 +573,6 @@ InOrderDynInst::disableMultiThreading(unsigned vpe) this->cpu->disableMultiThreading(threadNumber, vpe); } -void -InOrderDynInst::setThreadRescheduleCondition(uint32_t cond) -{ - this->cpu->setThreadRescheduleCondition(cond); -} - template inline Fault InOrderDynInst::read(Addr addr, T &data, unsigned flags) diff --git a/src/cpu/inorder/inorder_dyn_inst.hh b/src/cpu/inorder/inorder_dyn_inst.hh index 55c61ffb9..3b47624fb 100644 --- a/src/cpu/inorder/inorder_dyn_inst.hh +++ b/src/cpu/inorder/inorder_dyn_inst.hh @@ -481,8 +481,6 @@ class InOrderDynInst : public FastAlloc, public RefCounted virtual void enableMultiThreading(unsigned vpe); virtual void disableMultiThreading(unsigned vpe); - virtual void setThreadRescheduleCondition(uint32_t cond); - //////////////////////////////////////////////////////////// // // PROGRAM COUNTERS - PC/NPC/NPC diff --git a/src/cpu/inorder/thread_context.cc b/src/cpu/inorder/thread_context.cc index 13f8ecdad..0cac51559 100644 --- a/src/cpu/inorder/thread_context.cc +++ b/src/cpu/inorder/thread_context.cc @@ -46,7 +46,7 @@ InOrderThreadContext::takeOverFrom(ThreadContext *old_context) copyArchRegs(old_context); thread->funcExeInst = old_context->readFuncExeInst(); - old_context->setStatus(ThreadContext::Unallocated); + old_context->setStatus(ThreadContext::Halted); thread->inSyscall = false; thread->trapPending = false; } @@ -79,19 +79,6 @@ InOrderThreadContext::suspend(int delay) cpu->suspendContext(thread->readTid(), delay); } -void -InOrderThreadContext::deallocate(int delay) -{ - DPRINTF(InOrderCPU, "Calling deallocate on Thread Context %d\n", - getThreadNum()); - - if (thread->status() == ThreadContext::Unallocated) - return; - - thread->setStatus(ThreadContext::Unallocated); - cpu->deallocateContext(thread->readTid(), delay); -} - void InOrderThreadContext::halt(int delay) { diff --git a/src/cpu/inorder/thread_context.hh b/src/cpu/inorder/thread_context.hh index 3a1cb1379..ec8cc1979 100644 --- a/src/cpu/inorder/thread_context.hh +++ b/src/cpu/inorder/thread_context.hh @@ -118,9 +118,6 @@ class InOrderThreadContext : public ThreadContext /** Set the status to Suspended. */ virtual void suspend(int delay = 0); - /** Set the status to Unallocated. */ - virtual void deallocate(int delay = 1); - /** Set the status to Halted. */ virtual void halt(int delay = 0); @@ -244,32 +241,6 @@ class InOrderThreadContext : public ThreadContext virtual void changeRegFileContext(unsigned param, unsigned val) { panic("Not supported!"); } - - /** This function exits the thread context in the CPU and returns - * 1 if the CPU has no more active threads (meaning it's OK to exit); - * Used in syscall-emulation mode when a thread executes the 'exit' - * syscall. - */ - virtual int exit() - { - this->deallocate(); - - // If there are still threads executing in the system (for now - // this single cpu) - if (this->cpu->numActiveThreads() - 1 > 0) - return 0; // don't exit simulation - else - return 1; // exit simulation - } - - virtual void setThreadRescheduleCondition(uint64_t cond) - { - this->deallocate(); - - this->setStatus(ThreadContext::Suspended); - - activateContext(cond); - } }; #endif -- cgit v1.2.3