Remove temporary ifdef and refactor/simplify
authorAditya Mandaleeka <adityam@microsoft.com>
Sat, 8 Aug 2015 02:23:47 +0000 (19:23 -0700)
committerAditya Mandaleeka <adityam@microsoft.com>
Thu, 13 Aug 2015 19:25:15 +0000 (12:25 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/7c102f1ff7e3c49bd7d2f8f972ca3dcca3f5b48e

17 files changed:
src/coreclr/src/debug/daccess/dacdbiimplstackwalk.cpp
src/coreclr/src/inc/vptr_list.h
src/coreclr/src/vm/amd64/cgenamd64.cpp
src/coreclr/src/vm/amd64/unixasmhelpers.S
src/coreclr/src/vm/arm/asmhelpers.asm
src/coreclr/src/vm/arm/stubs.cpp
src/coreclr/src/vm/excep.cpp
src/coreclr/src/vm/excep.h
src/coreclr/src/vm/exceptionhandling.cpp
src/coreclr/src/vm/frames.h
src/coreclr/src/vm/i386/cgenx86.cpp
src/coreclr/src/vm/i386/excepx86.cpp
src/coreclr/src/vm/jithelpers.cpp
src/coreclr/src/vm/stackwalk.cpp
src/coreclr/src/vm/threads.cpp
src/coreclr/src/vm/threads.h
src/coreclr/src/vm/threadsuspend.cpp

index 294aeb3..8c59ef7 100644 (file)
@@ -1303,7 +1303,7 @@ bool DacDbiInterfaceImpl::IsThreadSuspendedOrHijacked(VMPTR_Thread vmThread)
         return true;
     }
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
     if ((ts & Thread::TS_Hijacked) != 0)
     {
         return true;
index bdcc4eb..a5198bb 100644 (file)
@@ -97,9 +97,9 @@ VPTR_CLASS(HelperMethodFrame)
 VPTR_CLASS(HelperMethodFrame_1OBJ)
 VPTR_CLASS(HelperMethodFrame_2OBJ)
 VPTR_CLASS(HelperMethodFrame_PROTECTOBJ)
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
 VPTR_CLASS(HijackFrame)
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif
 VPTR_CLASS(InlinedCallFrame)
 #if defined(FEATURE_INCLUDE_ALL_INTERFACES) && defined(_TARGET_X86_)
 VPTR_CLASS(LeaveRuntimeFrame)
@@ -112,10 +112,10 @@ VPTR_CLASS(PInvokeCalliFrame)
 VPTR_CLASS(PrestubMethodFrame)
 VPTR_CLASS(ProtectByRefsFrame)
 VPTR_CLASS(ProtectValueClassFrame)
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
 VPTR_CLASS(ResumableFrame)
 VPTR_CLASS(RedirectedThreadFrame)
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif
 VPTR_CLASS(StubDispatchFrame)
 VPTR_CLASS(ExternalMethodFrame)
 #ifdef FEATURE_READYTORUN
index c4fe6bd..27f1a4a 100644 (file)
@@ -258,7 +258,7 @@ void FaultingExceptionFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
     pRD->IsCallerSPValid      = FALSE;        // Don't add usage of this field.  This is only temporary.
 }
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
 TADDR ResumableFrame::GetReturnAddressPtr()
 {
     LIMITED_METHOD_DAC_CONTRACT;
@@ -344,7 +344,7 @@ void HijackFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
     pRD->SP   = (ULONG64)(pRD->PCTAddr + sizeof(TADDR));
 */
 }
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 
 BOOL isJumpRel32(PCODE pCode)
 {
index a05dcd3..e3f4adc 100644 (file)
@@ -172,7 +172,7 @@ NESTED_ENTRY JIT_RareDisableHelper, _TEXT, NoHandler
 
 NESTED_END JIT_RareDisableHelper, _TEXT
 
-#ifdef FEATURE_UNIX_GC_REDIRECT_HIJACK
+#ifdef FEATURE_HIJACK
 
 //------------------------------------------------
 // OnHijackScalarTripThread
@@ -262,7 +262,7 @@ NESTED_ENTRY OnHijackInteriorPointerTripThread, _TEXT, NoHandler
 
 NESTED_END OnHijackInteriorPointerTripThread, _TEXT
 
-#endif // FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 
 LEAF_ENTRY SinglecastDelegateInvokeStub, _TEXT                                        
                                                                                       
index 8ed440d..82c3808 100644 (file)
@@ -63,7 +63,7 @@
     IMPORT OnHijackObjectWorker
     IMPORT OnHijackInteriorPointerWorker
     IMPORT OnHijackScalarWorker
-#endif ; FEATURE_HIJACK
+#endif ;FEATURE_HIJACK
 
     IMPORT GetCurrentSavedRedirectContext
 
index 6794acc..368e6cf 100644 (file)
@@ -2389,7 +2389,6 @@ void InlinedCallFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
 }
 
 #ifdef FEATURE_HIJACK
-
 TADDR ResumableFrame::GetReturnAddressPtr(void) 
 { 
     LIMITED_METHOD_DAC_CONTRACT;
@@ -2470,8 +2469,7 @@ void HijackFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
 
      SyncRegDisplayToCurrentContext(pRD);
 }
-
-#endif // FEATURE_HIJACK
+#endif
 
 void PInvokeStubForHost(void)
 { 
index 00625da..d19d2f2 100644 (file)
@@ -7735,7 +7735,7 @@ LONG WINAPI CLRVectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo)
     // the operating system will not be able to walk the stack and not find the handlers for
     // the exception.  It is safe to unhijack the thread in this case for two reasons:
     // 1.  pThread refers to *this* thread.
-    // 2.  If another thread trys to hijack this thread, it will see we are not in managed
+    // 2.  If another thread tries to hijack this thread, it will see we are not in managed
     //     code (and thus won't try to hijack us).
 #if defined(WIN64EXCEPTIONS)
     if (pThread != NULL)
@@ -7784,7 +7784,7 @@ LONG WINAPI CLRVectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo)
     return retVal;
 #else // !FEATURE_PAL
 
-#ifdef FEATURE_UNIX_GC_REDIRECT_HIJACK
+#if defined(WIN64EXCEPTIONS) && defined(FEATURE_HIJACK)
     Thread *pThread = GetThread();
     if (pThread != NULL)
     {
@@ -8154,7 +8154,7 @@ BOOL IsIPInEE(void *ip)
     }
 }
 
-#if defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#if defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
 
 // This function is used to check if the specified IP is in the prolog or not.
 bool IsIPInProlog(EECodeInfo *pCodeInfo)
@@ -8309,7 +8309,7 @@ bool IsIPInEpilog(PTR_CONTEXT pContextToCheck, EECodeInfo *pCodeInfo, BOOL *pSaf
     return fIsInEpilog;
 }
 
-#endif // defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#endif // defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
 
 #define EXCEPTION_VISUALCPP_DEBUGGER        ((DWORD) (1<<30 | 0x6D<<16 | 5000))
 
index 36e7804..d411411 100644 (file)
@@ -26,13 +26,13 @@ class Thread;
 BOOL IsExceptionFromManagedCode(const EXCEPTION_RECORD * pExceptionRecord);
 bool IsIPInMarkedJitHelper(UINT_PTR uControlPc);
 
-#if defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#if defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
 
 // General purpose functions for use on an IP in jitted code. 
 bool IsIPInProlog(EECodeInfo *pCodeInfo);
 bool IsIPInEpilog(PTR_CONTEXT pContextToCheck, EECodeInfo *pCodeInfo, BOOL *pSafeToInjectThreadAbort);
 
-#endif // defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#endif // defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
 
 void RaiseFailFastExceptionOnWin7(PEXCEPTION_RECORD pExceptionRecord, PT_CONTEXT pContext);
 
index 08b9ef7..0b0dadd 100644 (file)
@@ -4543,9 +4543,7 @@ VOID DECLSPEC_NORETURN UnwindManagedExceptionPass1(PAL_SEHException& ex)
     ULONG64 stackHighAddress = (ULONG64)PAL_GetStackBase();
     ULONG64 stackLowAddress = (ULONG64)PAL_GetStackLimit();
 
-GetThread()->UnhijackThread(); //////////////
-
-
+    GetThread()->UnhijackThread();
 
     RtlCaptureContext(&frameContext);
 
index cbffc9d..44e38bf 100644 (file)
@@ -34,7 +34,7 @@
 //    +- FaultingExceptionFrame - this frame was placed on a method which faulted
 //    |                           to save additional state information
 //    |
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
 //    |
 //    +-HijackFrame             - if a method's return address is hijacked, we
 //    |                           construct one of these to allow crawling back
@@ -47,7 +47,7 @@
 //    | |
 //    | +-RedirectedThreadFrame - this frame is used for redirecting threads during suspension
 //    |
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 //    |
 //    |
 #ifdef FEATURE_REMOTING
@@ -217,10 +217,10 @@ Reverse P/Invoke AppDomain selector stub:
 FRAME_ABSTRACT_TYPE_NAME(FrameBase)
 FRAME_ABSTRACT_TYPE_NAME(Frame)
 FRAME_ABSTRACT_TYPE_NAME(TransitionFrame)
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
 FRAME_TYPE_NAME(ResumableFrame)
 FRAME_TYPE_NAME(RedirectedThreadFrame)
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 FRAME_TYPE_NAME(FaultingExceptionFrame)
 #ifdef DEBUGGING_SUPPORTED
 FRAME_TYPE_NAME(FuncEvalFrame)
@@ -242,9 +242,9 @@ FRAME_TYPE_NAME(ComPlusMethodFrame)
 FRAME_TYPE_NAME(ComPrestubMethodFrame)
 #endif // FEATURE_COMINTEROP
 FRAME_TYPE_NAME(PInvokeCalliFrame)
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
 FRAME_TYPE_NAME(HijackFrame)
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 FRAME_TYPE_NAME(PrestubMethodFrame)
 FRAME_TYPE_NAME(StubDispatchFrame)
 FRAME_TYPE_NAME(ExternalMethodFrame)
@@ -417,6 +417,7 @@ class Frame : public FrameBase
     VPTR_ABSTRACT_VTABLE_CLASS(Frame, FrameBase)
 
 public:
+
 #if defined(FEATURE_PAL) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
     virtual ~Frame();
 #endif // FEATURE_PAL && !DACCESS_COMPILE && !CROSSGEN_COMPILE
@@ -859,9 +860,9 @@ protected:
 // exception.  The FRAME_ATTR_RESUMABLE flag tells
 // the GC that the preceding frame needs to be treated
 // like the top of stack (with the important implication that
-// caller-save-registers will be potential roots).
+// caller-save-regsiters will be potential roots).
 //-----------------------------------------------------------------------------
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
 //-----------------------------------------------------------------------------
 
 class ResumableFrame : public Frame
@@ -923,8 +924,7 @@ class RedirectedThreadFrame : public ResumableFrame
 
 public:
 #ifndef DACCESS_COMPILE
-    RedirectedThreadFrame(T_CONTEXT *regs) : ResumableFrame(regs)
-    {
+    RedirectedThreadFrame(T_CONTEXT *regs) : ResumableFrame(regs) {
         LIMITED_METHOD_CONTRACT;
     }
 
@@ -953,14 +953,14 @@ inline T_CONTEXT * GETREDIRECTEDCONTEXT(Thread * thread)
 }
 
 //------------------------------------------------------------------------
-#else // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#else // FEATURE_HIJACK
 //------------------------------------------------------------------------
 
 inline BOOL ISREDIRECTEDTHREAD(Thread * thread) { LIMITED_METHOD_CONTRACT; return FALSE; }
 inline CONTEXT * GETREDIRECTEDCONTEXT(Thread * thread) { LIMITED_METHOD_CONTRACT; return (CONTEXT*) NULL; }
 
 //------------------------------------------------------------------------
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 //------------------------------------------------------------------------
 // This frame represents a transition from one or more nested frameless
 // method calls to either a EE runtime helper function or a framed method.
@@ -2114,7 +2114,7 @@ public:
 };
 
 // Some context-related forwards.
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
 //------------------------------------------------------------------------
 // This frame represents a hijacked return.  If we crawl back through it,
 // it gets us back to where the return should have gone (and eventually will
@@ -2158,7 +2158,7 @@ protected:
     DEFINE_VTABLE_GETTER_AND_CTOR(HijackFrame)
 };
 
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 
 //------------------------------------------------------------------------
 // This represents a call to a method prestub. Because the prestub
index df5e0dc..43409e2 100644 (file)
@@ -671,7 +671,7 @@ void HijackFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
     pRD->Esp  = (DWORD)(pRD->PCTAddr + sizeof(TADDR));
 }
 
-#endif // FEATURE_HIJACK
+#endif  // FEATURE_HIJACK
 
 void PInvokeCalliFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
 {
index 7c865d7..6bf26a4 100644 (file)
@@ -365,8 +365,8 @@ CPFH_VerifyThreadIsInValidState(Thread* pThread, DWORD exceptionCode, EXCEPTION_
     }
 }
 
-#ifdef FEATURE_HIJACK
 
+#ifdef FEATURE_HIJACK
 void
 CPFH_AdjustContextForThreadSuspensionRace(CONTEXT *pContext, Thread *pThread)
 {
@@ -429,7 +429,6 @@ CPFH_AdjustContextForThreadSuspensionRace(CONTEXT *pContext, Thread *pThread)
         STRESS_LOG1(LF_EH, LL_INFO100, "CPFH_AdjustContextForThreadSuspensionRace: Case 4 setting IP = %x\n", pContext->Eip);
     }
 }
-
 #endif // FEATURE_HIJACK
 
 
index e9bfd4c..2e29715 100644 (file)
@@ -6397,7 +6397,7 @@ void F_CALL_VA_CONV JIT_TailCall(PCODE copyArgs, PCODE target, ...)
     
     Thread *pThread = GetThread();
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
     // We can't crawl the stack of a thread that currently has a hijack pending
     // (since the hijack routine won't be recognized by any code manager). So we
     // undo any hijack, the EE will re-attempt it later.
index 84b6f3b..2951f27 100644 (file)
@@ -1205,7 +1205,7 @@ BOOL StackFrameIterator::Init(Thread *    pThread,
 
     BEGIN_FORBID_TYPELOAD();
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
     // We can't crawl the stack of a thread that currently has a hijack pending
     // (since the hijack routine won't be recognized by any code manager). So we
     // undo any hijack, the EE will re-attempt it later.
@@ -1215,7 +1215,7 @@ BOOL StackFrameIterator::Init(Thread *    pThread,
     pThread->UnhijackThread();
 #endif // !DACCESS_COMPILE
 
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 
     // FRAME_TOP and NULL must be distinct values. This assert
     // will fire if someone changes this.
@@ -1569,7 +1569,7 @@ BOOL StackFrameIterator::IsValid(void)
         //  In normal case (no GCStress), after p/invoke, IL_STUB will check if GC is in progress and syncronize.
         BOOL bRedirectedPinvoke = FALSE;
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
         bRedirectedPinvoke = ((GCStress<cfg_instr>::IsEnabled()) && 
                               (m_pRealStartFrame != NULL) &&
                               (m_pRealStartFrame != FRAME_TOP) &&
@@ -1577,7 +1577,7 @@ BOOL StackFrameIterator::IsValid(void)
                               (m_pThread->GetFrame() != NULL) &&
                               (m_pThread->GetFrame() != FRAME_TOP) &&
                               (m_pThread->GetFrame()->GetVTablePtr() == RedirectedThreadFrame::GetMethodFrameVPtr()));
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 
         _ASSERTE( (m_pStartFrame != NULL) ||
                   (m_flags & POPFRAMES) ||
index 0e6bcff..c546c04 100644 (file)
@@ -2018,12 +2018,10 @@ Thread::Thread()
     m_pCurrentStackGuard = NULL;
 #endif
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
     m_ppvHJRetAddrPtr = (VOID**) 0xCCCCCCCCCCCCCCCC;
     m_pvHJRetAddr = (VOID*) 0xCCCCCCCCCCCCCCCC;
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
 
-#ifdef FEATURE_HIJACK
     X86_ONLY(m_LastRedirectIP = 0);
     X86_ONLY(m_SpinCount = 0);
 #endif // FEATURE_HIJACK
@@ -8246,9 +8244,9 @@ void CommonTripThread()
     if (thread->CatchAtSafePoint())
     {
         _ASSERTE(!ThreadStore::HoldingThreadStore(thread));
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
         thread->UnhijackThread();
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 
         // Trap
         thread->PulseGCMode();
@@ -11243,7 +11241,7 @@ void Thread::AddFiberInfo(DWORD type)
         pInfo->timeStamp = getTimeStamp();
         pInfo->threadID = GetCurrentThreadId();
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
         // We can't crawl the stack of a thread that currently has a hijack pending
         // (since the hijack routine won't be recognized by any code manager). So we
         // undo any hijack, the EE will re-attempt it later.
index 67c4902..c8c888d 100644 (file)
@@ -551,13 +551,13 @@ EXTERN_C void LeaveSyncHelper    (UINT_PTR caller, void *pAwareLock);
 
 #endif  // TRACK_SYNC
 
-#if defined(FEATURE_HIJACK)
+//***************************************************************************
+#ifdef FEATURE_HIJACK
 
 // Used to capture information about the state of execution of a *SUSPENDED* thread.
 struct ExecutionState;
 
 #ifndef PLATFORM_UNIX
-//***************************************************************************
 // This is the type of the start function of a redirected thread pulled from
 // a HandledJITCase during runtime suspension
 typedef void (__stdcall *PFN_REDIRECTTARGET)();
@@ -569,7 +569,6 @@ struct HijackArgs;
 #endif // FEATURE_HIJACK
 
 //***************************************************************************
-
 #ifdef ENABLE_CONTRACTS_IMPL
 inline Thread* GetThreadNULLOk()
 {
@@ -685,15 +684,17 @@ void InitThreadManager();
 // When we want to take control of a thread at a safe point, the thread will
 // eventually come back to us in one of the following trip functions:
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
+
 EXTERN_C void __stdcall OnHijackObjectTripThread();                 // hijacked JIT code is returning an objectref
 EXTERN_C void __stdcall OnHijackInteriorPointerTripThread();        // hijacked JIT code is returning a byref
 EXTERN_C void __stdcall OnHijackScalarTripThread();                 // hijacked JIT code is returning a non-objectref, non-FP
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
 
-#if defined(FEATURE_HIJACK) && defined(_TARGET_X86_)
+#ifdef _TARGET_X86_
 EXTERN_C void __stdcall OnHijackFloatingPointTripThread();          // hijacked JIT code is returning an FP value
-#endif // FEATURE_HIJACK && _TARGET_X86_
+#endif // _TARGET_X86_
+
+#endif // FEATURE_HIJACK
 
 void CommonTripThread();
 
@@ -1012,11 +1013,11 @@ typedef DWORD (*AppropriateWaitFunc) (void *args, DWORD timeout, DWORD option);
 // unstarted System.Thread), then this instance can be found in the TLS
 // of that physical thread.
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
 EXTERN_C void STDCALL OnHijackObjectWorker(HijackArgs * pArgs);
 EXTERN_C void STDCALL OnHijackInteriorPointerWorker(HijackArgs * pArgs);
 EXTERN_C void STDCALL OnHijackScalarWorker(HijackArgs * pArgs);
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 
 // This is the code we pass around for Thread.Interrupt, mainly for assertions
 #define APC_Code    0xEECEECEE
@@ -1060,17 +1061,18 @@ class Thread: public IUnknown
 
     friend void CommonTripThread();
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
     // MapWin32FaultToCOMPlusException needs access to Thread::IsAddrOfRedirectFunc()
     friend DWORD MapWin32FaultToCOMPlusException(EXCEPTION_RECORD *pExceptionRecord);
     friend void STDCALL OnHijackObjectWorker(HijackArgs *pArgs);
     friend void STDCALL OnHijackInteriorPointerWorker(HijackArgs *pArgs);
     friend void STDCALL OnHijackScalarWorker(HijackArgs *pArgs);
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
 
-#ifdef FEATURE_UNIX_GC_REDIRECT_HIJACK
+#ifdef PLATFORM_UNIX
     friend void PALAPI HandleGCSuspensionForInterruptedThread(CONTEXT *interruptedContext);
-#endif // FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // PLATFORM_UNIX
+
+#endif // FEATURE_HIJACK
 
     friend void         InitThreadManager();
     friend void         ThreadBaseObject::SetDelegate(OBJECTREF delegate);
@@ -1147,9 +1149,9 @@ public:
 
         TS_YieldRequested         = 0x00000040,    // The task should yield
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
         TS_Hijacked               = 0x00000080,    // Return address has been hijacked
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 
         TS_BlockGCForSO           = 0x00000100,    // If a thread does not have enough stack, WaitUntilGCComplete may fail.
                                                    // Either GC suspension will wait until the thread has cleared this bit,
@@ -2847,9 +2849,9 @@ public:
         STR_SwitchedOut,
     };
 
-#ifdef FEATURE_UNIX_GC_REDIRECT_HIJACK
+#if defined(FEATURE_HIJACK) && defined(PLATFORM_UNIX)
     bool InjectGcSuspension();
-#endif // FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK && PLATFORM_UNIX
 
 #ifndef DISABLE_THREADSUSPEND
     // SuspendThread
@@ -3165,9 +3167,9 @@ public:
     BOOL           IsRudeUnload();
     BOOL           IsFuncEvalAbort();
 
-#if defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#if defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
     BOOL           IsSafeToInjectThreadAbort(PTR_CONTEXT pContextToCheck);
-#endif // defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#endif // defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
 
     inline BOOL IsAbortRequested()
     {
@@ -3950,7 +3952,7 @@ private:
 public:
     FORCEINLINE void UnhijackThreadNoAlloc()
     {
-#if (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)) && !defined(DACCESS_COMPILE)
+#if defined(FEATURE_HIJACK) && !defined(DACCESS_COMPILE)
         if (m_State & TS_Hijacked)
         {
             *m_ppvHJRetAddrPtr = m_pvHJRetAddr;
@@ -3987,14 +3989,14 @@ public:
     BOOL GetSafelyRedirectableThreadContext(DWORD dwOptions, T_CONTEXT * pCtx, REGDISPLAY * pRD);
 
 private:
-#if defined(FEATURE_HIJACK)
+#ifdef FEATURE_HIJACK
     void    HijackThread(VOID *pvHijackAddr, ExecutionState *esb);
 
     VOID        *m_pvHJRetAddr;           // original return address (before hijack)
     VOID       **m_ppvHJRetAddrPtr;       // place we bashed a new return address
     MethodDesc  *m_HijackedFunction;      // remember what we hijacked
 
-#if !defined(PLATFORM_UNIX)
+#ifndef PLATFORM_UNIX
     BOOL    HandledJITCase(BOOL ForTaskSwitchIn = FALSE);
 
 #ifdef _TARGET_X86_
@@ -4563,13 +4565,13 @@ public:
     {
         WRAPPER_NO_CONTRACT;
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
-        // Only unhijack the thread if the suspend succeeded.  If it failed, 
+#ifdef FEATURE_HIJACK
+        // Only unhijack the thread if the suspend succeeded. If it failed, 
         // the target thread may currently be using the original stack
         // location of the return address for something else.
         if (SuspendSucceeded)
             UnhijackThread();
-#endif // defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#endif // FEATURE_HIJACK
 
         ResetThreadState(TS_GCSuspendPending);
     }
@@ -5288,15 +5290,15 @@ public:
     {
         WRAPPER_NO_CONTRACT;
 
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
         UnhijackThread();
-#endif // defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#endif // FEATURE_HIJACK
 
         ResetThrowControlForThread();
 
         // Since this Thread has taken an SO, there may be state left-over after we
-        //  short-circuited exception or other error handling, and so we don't want
-        //  to risk recycling it.
+        // short-circuited exception or other error handling, and so we don't want
+        // to risk recycling it.
         SetThreadStateNC(TSNC_CannotRecycle);
     }
 
index 0757ffd..0cc412a 100644 (file)
@@ -1296,7 +1296,7 @@ BOOL Thread::IsWithinCer(CrawlFrame *pCf)
     return sContext.m_fWithinCer;
 }
 
-#if defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#if defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
 BOOL Thread::IsSafeToInjectThreadAbort(PTR_CONTEXT pContextToCheck)
 {
     CONTRACTL
@@ -1330,7 +1330,7 @@ BOOL Thread::IsSafeToInjectThreadAbort(PTR_CONTEXT pContextToCheck)
         return TRUE;
     }
 }
-#endif // defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#endif // defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
 
 #ifdef _TARGET_AMD64_
 // CONTEXT_CONTROL does not include any nonvolatile registers that might be the frame pointer.
@@ -1428,7 +1428,7 @@ BOOL Thread::ReadyForAsyncException(ThreadInterruptMode mode)
                 pStartFrame = pFrameAddr;
             }
         }
-#if defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#if defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
         else if (ThrewControlForThread() == Thread::InducedThreadRedirect)
         {
             if (!IsSafeToInjectThreadAbort(m_OSContext))
@@ -1437,7 +1437,7 @@ BOOL Thread::ReadyForAsyncException(ThreadInterruptMode mode)
                 return FALSE;
             }
         }
-#endif // defined(_TARGET_AMD64_) && (defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK))
+#endif // defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
     }
     else
     {
@@ -3794,10 +3794,10 @@ void Thread::RareEnablePreemptiveGC()
     STRESS_LOG1(LF_SYNC, LL_INFO100000, "RareEnablePreemptiveGC: entering. Thread state = %x\n", m_State.Load());
     if (!ThreadStore::HoldingThreadStore(this))
     {
-#if defined(FEATURE_HIJACK) || defined(FEATURE_UNIX_GC_REDIRECT_HIJACK)
+#ifdef FEATURE_HIJACK
         // Remove any hijacks we might have.
         UnhijackThread();
-#endif // FEATURE_HIJACK || FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK
 
         // wake up any threads waiting to suspend us, like the GC thread.
         SetSafeEvent();
@@ -4985,13 +4985,13 @@ HRESULT ThreadSuspend::SuspendRuntime(ThreadSuspend::SUSPEND_REASON reason)
                 FastInterlockOr((ULONG *) &thread->m_State, Thread::TS_GCSuspendPending);
                 countThreads++;
 
-#ifdef FEATURE_UNIX_GC_REDIRECT_HIJACK
+#if defined(FEATURE_HIJACK) && defined(PLATFORM_UNIX)
                 bool gcSuspensionSignalSuccess = thread->InjectGcSuspension();
                 if (!gcSuspensionSignalSuccess)
                 {
                     STRESS_LOG1(LF_SYNC, LL_INFO1000, "Thread::SuspendRuntime() -   Failed to raise GC suspension signal for thread %p.\n", thread);
                 }
-#endif // FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK && PLATFORM_UNIX
             }
 
 #else // DISABLE_THREADSUSPEND
@@ -5328,7 +5328,7 @@ HRESULT ThreadSuspend::SuspendRuntime(ThreadSuspend::SUSPEND_REASON reason)
             }
 #endif
 
-#ifdef FEATURE_UNIX_GC_REDIRECT_HIJACK
+#if defined(FEATURE_HIJACK) && defined(PLATFORM_UNIX)
             _ASSERTE (thread == NULL);
             while ((thread = ThreadStore::GetThreadList(thread)) != NULL)
             {
@@ -8257,7 +8257,7 @@ retry_for_debugger:
 #endif //TIME_SUSPEND
 }
 
-#ifdef FEATURE_UNIX_GC_REDIRECT_HIJACK
+#if defined(FEATURE_HIJACK) && defined(PLATFORM_UNIX)
 
 // This function is called when a GC is pending. It tries to ensure that the current
 // thread is taken to a GC-safe place as quickly as possible. It does this by doing 
@@ -8376,7 +8376,7 @@ bool Thread::InjectGcSuspension()
     return false;
 }
 
-#endif // FEATURE_UNIX_GC_REDIRECT_HIJACK
+#endif // FEATURE_HIJACK && PLATFORM_UNIX
 
 #ifdef _DEBUG
 BOOL Debug_IsLockedViaThreadSuspension()