From 49ca3db92a48da71d25c607af9716a30bafb3ff8 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Mon, 10 Dec 2018 02:57:57 -0800 Subject: Delete vm/context.* (#21459) * Delete vm/context.* Leftover from remoting --- src/vm/threads.h | 95 ++++++-------------------------------------------------- 1 file changed, 10 insertions(+), 85 deletions(-) (limited to 'src/vm/threads.h') diff --git a/src/vm/threads.h b/src/vm/threads.h index 630a21eb21..0c282d8da0 100644 --- a/src/vm/threads.h +++ b/src/vm/threads.h @@ -138,7 +138,6 @@ #include "util.hpp" #include "eventstore.hpp" #include "argslot.h" -#include "context.h" #include "regdisp.h" #include "mscoree.h" #include "gcheaputilities.h" @@ -173,6 +172,8 @@ struct ThreadLocalBlock; typedef DPTR(struct ThreadLocalBlock) PTR_ThreadLocalBlock; typedef DPTR(PTR_ThreadLocalBlock) PTR_PTR_ThreadLocalBlock; +typedef void(*ADCallBackFcnType)(LPVOID); + #include "stackwalktypes.h" #include "log.h" #include "stackingallocator.h" @@ -308,8 +309,6 @@ public: inline void IncLockCount() { } inline void DecLockCount() { } - void EnterContextRestricted(Context* c, ContextTransitionFrame* pFrame) { } - static LPVOID GetStaticFieldAddress(FieldDesc *pFD) { return NULL; } PTR_AppDomain GetDomain() { return ::GetAppDomain(); } @@ -1050,7 +1049,6 @@ class Thread: public IUnknown friend class ThreadStore; friend class ThreadSuspend; friend class SyncBlock; - friend class Context; friend struct PendingSync; friend class AppDomain; friend class ThreadNative; @@ -1717,13 +1715,8 @@ public: } #endif // FEATURE_COMINTEROP && !DACCESS_COMPILE - // The context within which this thread is executing. As the thread crosses - // context boundaries, the context mechanism adjusts this so it's always - // current. - // @TODO cwb: When we add COM+ 1.0 Context Interop, this should get moved out - // of the Thread object and into its own slot in the TLS. - // The address of the context object is also used as the ContextID! - PTR_Context m_Context; + // Lock thread is trying to acquire + VolatilePtr m_pBlockingLock; public: @@ -1862,9 +1855,6 @@ private: // or interlocked operations to get a new hash code; DWORD m_dwHashCodeSeed; - // Lock thread is trying to acquire - VolatilePtr m_pBlockingLock; - public: inline BOOL HasLockInCurrentDomain() @@ -2448,33 +2438,6 @@ public: return PTR_ThreadExceptionState(PTR_HOST_MEMBER_TADDR(Thread, this, m_ExceptionState)); } - // Access to the Context this thread is executing in. - Context *GetContext() - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; -#ifndef DACCESS_COMPILE - - // if another thread is asking about our thread, we could be in the middle of an AD transition so - // the context and AD may not match if have set one but not the other. Can live without checking when - // another thread is asking it as this method is mostly called on our own thread so will mostly get the - // checking. If are int the middle of a transition, this could return either the old or the new AD. - // But no matter what we do, such as lock on the transition, by the time are done could still have - // changed right after we asked, so really no point. - _ASSERTE((this != GetThreadNULLOk()) || (m_Context == NULL && m_pDomain == NULL) || (m_Context->GetDomain() == m_pDomain) || g_fEEShutDown); -#endif // DACCESS_COMPILE - return m_Context; - } - - void DoContextCallBack(ADID appDomain, Context* c , Context::ADCallBackFcnType pTarget, LPVOID args); - - // Except for security and the call in from the remoting code in mscorlib, you should never do an - // AppDomain transition directly through these functions. Rather, you should use DoADCallBack above - // to call into managed code to perform the transition for you so that the correct policy code etc - // is run on the transition, - void EnterContextRestricted(Context* c, ContextTransitionFrame* pFrame); - void ReturnToContext(ContextTransitionFrame *pFrame); - public: void DECLSPEC_NORETURN RaiseCrossContextException(Exception* pEx, ContextTransitionFrame* pFrame); @@ -2482,10 +2445,6 @@ public: // ClearContext are to be called only during shutdown void ClearContext(); -private: - void ReturnToContextAndThrow(ContextTransitionFrame* pFrame, EEException* pEx, BOOL* pContextSwitched); - void ReturnToContextAndOOM(ContextTransitionFrame* pFrame); - private: // don't ever call these except when creating thread!!!!! void InitContext(); @@ -6797,12 +6756,6 @@ private: (_ctx_trans_pCurrDomain==NULL || \ (_ctx_trans_pCurrDomain->GetId() != _ctx_trans_pDestDomainId))) \ { \ - AppDomain* _ctx_trans_ad = SystemDomain::GetAppDomainFromId(_ctx_trans_pDestDomainId, ADV_CURRENTAD); \ - \ - _ctx_trans_ad->EnterContext(_ctx_trans_pThread, \ - _ctx_trans_ad->GetDefaultContext(), \ - _ctx_trans_pFrame); \ - \ _ctx_trans_fTransitioned = true; \ } @@ -6816,10 +6769,6 @@ private: TESTHOOKCALL(AppDomainCanBeUnloaded(_ctx_trans_pDestDomain->GetId().m_dwId,FALSE)); \ GCX_FORBID(); \ \ - _ctx_trans_pThread->EnterContextRestricted( \ - _ctx_trans_pDestDomain->GetDefaultContext(), \ - _ctx_trans_pFrame); \ - \ _ctx_trans_fTransitioned = true; \ } @@ -6880,11 +6829,6 @@ private: LOG((LF_APPDOMAIN, LL_INFO1000, "LEAVE_DOMAIN(%s, %s, %d)\n", \ __FUNCTION__, __FILE__, __LINE__)); \ \ - if (_ctx_trans_fTransitioned) \ - { \ - GCX_FORBID(); \ - _ctx_trans_pThread->ReturnToContext(_ctx_trans_pFrame); \ - } \ TESTHOOKCALL(LeftAppDomain(_ctx_trans_pDestDomainId.m_dwId)); \ DEBUG_ASSURE_NO_RETURN_END(DOMAIN) \ } @@ -6948,15 +6892,13 @@ void CheckADValidity(AppDomain* pDomain, DWORD ADValidityKind); CheckADValidity(_pDestDomain,ADValidityKind); \ ENTER_DOMAIN_SETUPVARS(GetThread(), true) \ ENTER_DOMAIN_SWITCH_CTX_BY_ADPTR(_ctx_trans_pThread->GetDomain(), _pDestDomain) \ - TESTHOOKCALL(EnteredAppDomain((_pDestDomain)->GetId().m_dwId)); \ - ReturnToPreviousAppDomainHolder __returnToPreviousAppDomainHolder; + TESTHOOKCALL(EnteredAppDomain((_pDestDomain)->GetId().m_dwId)); #define ENTER_DOMAIN_ID_NO_EH_AT_TRANSITION_PREDICATED(_pDestDomain,_predicate_expr) \ TESTHOOKCALL(EnteringAppDomain(_pDestDomain.m_dwId)) ; \ ENTER_DOMAIN_SETUPVARS(GetThread(), _predicate_expr) \ ENTER_DOMAIN_SWITCH_CTX_BY_ADID(_ctx_trans_pThread->GetDomain(), _pDestDomain, FALSE) \ - TESTHOOKCALL(EnteredAppDomain(_pDestDomain.m_dwId)); \ - ReturnToPreviousAppDomainHolder __returnToPreviousAppDomainHolder; + TESTHOOKCALL(EnteredAppDomain(_pDestDomain.m_dwId)); #define ENTER_DOMAIN_ID_NO_EH_AT_TRANSITION(_pDestDomain) \ ENTER_DOMAIN_ID_NO_EH_AT_TRANSITION_PREDICATED(_pDestDomain,true) @@ -6966,11 +6908,6 @@ void CheckADValidity(AppDomain* pDomain, DWORD ADValidityKind); LOG((LF_APPDOMAIN, LL_INFO1000, "LEAVE_DOMAIN(%s, %s, %d)\n", \ __FUNCTION__, __FILE__, __LINE__)); \ \ - if (_ctx_trans_fTransitioned) \ - { \ - GCX_FORBID(); \ - _ctx_trans_pThread->ReturnToContext(_ctx_trans_pFrame); \ - } \ __returnToPreviousAppDomainHolder.SuppressRelease(); \ TESTHOOKCALL(LeftAppDomain(_ctx_trans_pDestDomainId.m_dwId)); \ DEBUG_ASSURE_NO_RETURN_END(DOMAIN) \ @@ -7090,12 +7027,12 @@ struct ManagedThreadBase { // The 'new Thread(...).Start()' case from COMSynchronizable kickoff thread worker static void KickOff(ADID pAppDomain, - Context::ADCallBackFcnType pTarget, + ADCallBackFcnType pTarget, LPVOID args); // The IOCompletion, QueueUserWorkItem, AddTimer, RegisterWaitForSingleObject cases in // the ThreadPool - static void ThreadPool(ADID pAppDomain, Context::ADCallBackFcnType pTarget, LPVOID args); + static void ThreadPool(ADID pAppDomain, ADCallBackFcnType pTarget, LPVOID args); // The Finalizer thread separates the tasks of establishing exception handling at its // base and transitioning into AppDomains. The turnaround structure that ties the 2 calls together @@ -7105,9 +7042,9 @@ struct ManagedThreadBase // For the case (like Finalization) where the base transition and the AppDomain transition are // separated, an opaque structure is used to tie together the two calls. - static void FinalizerBase(Context::ADCallBackFcnType pTarget); + static void FinalizerBase(ADCallBackFcnType pTarget); static void FinalizerAppDomain(AppDomain* pAppDomain, - Context::ADCallBackFcnType pTarget, + ADCallBackFcnType pTarget, LPVOID args, ManagedThreadCallState *pTurnAround); }; @@ -7156,18 +7093,6 @@ public: typedef StateHolder BlockingLockHolder; }; -inline Context* GetCurrentContext() -{ - CONTRACTL { - SO_TOLERANT; - NOTHROW; - GC_NOTRIGGER; - } - CONTRACTL_END; - - return GetThread()->GetContext(); -} - inline void SetTypeHandleOnThreadForAlloc(TypeHandle th) { // We are doing this unconditionally even though th is only used by ETW events in GC. When the ETW -- cgit v1.2.3