diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake index 222eead41676c..afe644af3535b 100644 --- a/src/coreclr/clrdefinitions.cmake +++ b/src/coreclr/clrdefinitions.cmake @@ -170,9 +170,6 @@ if (CLR_CMAKE_HOST_UNIX AND CLR_CMAKE_TARGET_UNIX) add_definitions(-DFEATURE_REMOTE_PROC_MEM) endif (CLR_CMAKE_HOST_UNIX AND CLR_CMAKE_TARGET_UNIX) -if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64) - add_definitions(-DFEATURE_STUBS_AS_IL) -endif () if (FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) add_definitions(-DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) endif(FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) diff --git a/src/coreclr/vm/amd64/GenericComCallStubs.asm b/src/coreclr/vm/amd64/GenericComCallStubs.asm index a49d2bbfc80cf..f4e6eccc666ff 100644 --- a/src/coreclr/vm/amd64/GenericComCallStubs.asm +++ b/src/coreclr/vm/amd64/GenericComCallStubs.asm @@ -107,14 +107,10 @@ OFFSETOF_GSCookie = GenericComCallStub_ComMethodFrame_OFFSET - SIZEOF_GSCookie mov [rsp + OFFSETOF_GSCookie], rcx ; - ; Call COMToCLRWorker. Note that the first parameter (pThread) is - ; filled in by callee. + ; Call COMToCLRWorker. ; -ifdef _DEBUG - mov rcx, 0cccccccccccccccch -endif - mov rdx, r10 + mov rcx, r10 call COMToCLRWorker ifdef _DEBUG diff --git a/src/coreclr/vm/arm64/asmhelpers.asm b/src/coreclr/vm/arm64/asmhelpers.asm index 983142dba748d..fd66033e898f5 100644 --- a/src/coreclr/vm/arm64/asmhelpers.asm +++ b/src/coreclr/vm/arm64/asmhelpers.asm @@ -523,7 +523,7 @@ GenericComCallStub_FirstStackAdjust SETA GenericComCallStub_FirstStackAdjust SAVE_FLOAT_ARGUMENT_REGISTERS sp, 0 str x12, [sp, #(GenericComCallStub_FrameOffset + UnmanagedToManagedFrame__m_pvDatum)] - add x1, sp, #GenericComCallStub_FrameOffset + add x0, sp, #GenericComCallStub_FrameOffset bl COMToCLRWorker ; pop the stack diff --git a/src/coreclr/vm/comtoclrcall.cpp b/src/coreclr/vm/comtoclrcall.cpp index 925372cbe3ad0..7d5b9e3140511 100644 --- a/src/coreclr/vm/comtoclrcall.cpp +++ b/src/coreclr/vm/comtoclrcall.cpp @@ -34,53 +34,15 @@ #if !defined(DACCESS_COMPILE) -#ifdef TARGET_X86 -static PCODE g_pGenericComCallStubFields = NULL; -static PCODE g_pGenericComCallStub = NULL; -#endif - UINT64 FieldCallWorker(Thread *pThread, ComMethodFrame* pFrame); void FieldCallWorkerDebuggerWrapper(Thread *pThread, ComMethodFrame* pFrame); void FieldCallWorkerBody(Thread *pThread, ComMethodFrame* pFrame); -//--------------------------------------------------------- -// void SetupGenericStubs() -// -// Throws on failure -//--------------------------------------------------------- -static void SetupGenericStubs() -{ - STANDARD_VM_CONTRACT; - -#ifdef TARGET_X86 - if ( (g_pGenericComCallStubFields != NULL) && (g_pGenericComCallStub != NULL)) - return; - - StubHolder candidateCall, candidateFields; - - // Build each one. If we get a collision on replacement, favor the one that's - // already there. (We have lifetime issues with these, because they are used - // in every VTable without refcounting, so we don't want them to change - // underneath us). - - // Allocate all three before setting - if an error occurs, we'll free the - // memory via holder objects and throw. - candidateCall = ComCall::CreateGenericComCallStub(FALSE/*notField*/); - candidateFields = ComCall::CreateGenericComCallStub(TRUE/*Field*/); - - if (InterlockedCompareExchangeT(&g_pGenericComCallStub, candidateCall->GetEntryPoint(), 0) == 0) - candidateCall.SuppressRelease(); - - if (InterlockedCompareExchangeT(&g_pGenericComCallStubFields, candidateFields->GetEntryPoint(), 0) == 0) - candidateFields.SuppressRelease(); -#endif // TARGET_X86 -} - #ifdef PROFILING_SUPPORTED // The sole purpose of this helper is to transition into preemptive mode // and then call the profiler transition callbacks. We can't use the GCX_PREEMP // in a function with SEH (such as COMToCLRWorkerBody()). -NOINLINE +static NOINLINE void ProfilerTransitionCallbackHelper(MethodDesc* pMD, Thread* pThread, COR_PRF_TRANSITION_REASON reason) { CONTRACTL @@ -108,7 +70,7 @@ void ProfilerTransitionCallbackHelper(MethodDesc* pMD, Thread* pThread, COR_PRF_ #endif // PROFILING_SUPPORTED // Disable when calling into managed code from a place that fails via HRESULT -extern "C" HRESULT STDCALL StubRareDisableHRWorker(Thread *pThread) +static HRESULT StubRareDisableHRWorker(Thread *pThread) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; @@ -241,7 +203,7 @@ inline static void InvokeStub(ComCallMethodDesc *pCMD, PCODE pManagedTarget, OBJ #pragma optimize("t", on) // optimize for speed #endif -OBJECTREF COMToCLRGetObjectAndTarget_Delegate(ComCallWrapper * pWrap, PCODE * ppManagedTargetOut) +static OBJECTREF COMToCLRGetObjectAndTarget_Delegate(ComCallWrapper * pWrap, PCODE * ppManagedTargetOut) { CONTRACTL { @@ -260,7 +222,7 @@ OBJECTREF COMToCLRGetObjectAndTarget_Delegate(ComCallWrapper * pWrap, PCODE * pp return pDelObj->GetTarget(); } -FORCEINLINE_NONDEBUG +static FORCEINLINE_NONDEBUG OBJECTREF COMToCLRGetObjectAndTarget_Virtual(ComCallWrapper * pWrap, MethodDesc * pRealMD, ComCallMethodDesc * pCMD, PCODE * ppManagedTargetOut) { CONTRACTL @@ -291,7 +253,7 @@ OBJECTREF COMToCLRGetObjectAndTarget_Virtual(ComCallWrapper * pWrap, MethodDesc return pObject; } -FORCEINLINE_NONDEBUG +static FORCEINLINE_NONDEBUG OBJECTREF COMToCLRGetObjectAndTarget_NonVirtual(ComCallWrapper * pWrap, MethodDesc * pRealMD, ComCallMethodDesc * pCMD, PCODE * ppManagedTargetOut) { CONTRACTL @@ -308,7 +270,7 @@ OBJECTREF COMToCLRGetObjectAndTarget_NonVirtual(ComCallWrapper * pWrap, MethodDe return pWrap->GetObjectRef(); } -FORCEINLINE_NONDEBUG +static FORCEINLINE_NONDEBUG void COMToCLRInvokeTarget(PCODE pManagedTarget, OBJECTREF pObject, ComCallMethodDesc * pCMD, ComMethodFrame * pFrame, Thread * pThread, UINT64* pRetValOut) { @@ -330,7 +292,7 @@ void COMToCLRInvokeTarget(PCODE pManagedTarget, OBJECTREF pObject, ComCallMethod InvokeStub(pCMD, pManagedTarget, pObject, pFrame, pThread, pRetValOut); } -NOINLINE +static NOINLINE void COMToCLRWorkerBody_Rare(Thread * pThread, ComMethodFrame * pFrame, ComCallWrapper * pWrap, MethodDesc * pRealMD, ComCallMethodDesc * pCMD, DWORD maskedFlags, UINT64 * pRetValOut) @@ -381,7 +343,7 @@ void COMToCLRWorkerBody_Rare(Thread * pThread, ComMethodFrame * pFrame, ComCallW // This is the factored out body of COMToCLRWorker. -FORCEINLINE_NONDEBUG +static FORCEINLINE_NONDEBUG void COMToCLRWorkerBody( Thread * pThread, ComMethodFrame * pFrame, @@ -456,26 +418,20 @@ void COMToCLRWorkerBody( } //------------------------------------------------------------------ -// UINT64 __stdcall COMToCLRWorker(Thread *pThread, -// ComMethodFrame* pFrame) +// UINT64 __stdcall COMToCLRWorker(ComMethodFrame* pFrame) //------------------------------------------------------------------ -extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFrame) +extern "C" UINT64 __stdcall COMToCLRWorker(ComMethodFrame* pFrame) { CONTRACTL { NOTHROW; // Although CSE can be thrown GC_TRIGGERS; -#if defined(TARGET_X86) - MODE_COOPERATIVE; // X86 sets up COOP in stublinker-generated stub -#else // This contract is disabled because user code can illegally reenter here through no fault of the // CLR (i.e. it's a user code bug), so we shouldn't be popping ASSERT dialogs in those cases. Note // that this reentrancy check is already done by the stublinker-generated stub on x86, so it's OK // to leave the MODE_ contract enabled on x86. DISABLED(MODE_PREEMPTIVE); -#endif PRECONDITION(CheckPointer(pFrame)); - PRECONDITION(CheckPointer(pThread, NULL_OK)); } CONTRACTL_END; @@ -483,17 +439,9 @@ extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFra ComCallMethodDesc* pCMD = pFrame->GetComCallMethodDesc(); -#if !defined(TARGET_X86) - // - // The following code is a transcription of the code that is generated by CreateGenericComCallStub. The - // idea is that we needn't really do this work either in static assembly code nor in dynamically - // generated code since the benefit/cost ratio is low. There are some minor differences in the below - // code, compared to x86. - // We must check each time at runtime here because we're using static code. - // HRESULT hr = S_OK; - pThread = GetThreadNULLOk(); + Thread* pThread = GetThreadNULLOk(); if (pThread == NULL) { pThread = SetupThreadNoThrow(); @@ -528,8 +476,6 @@ extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFra // Link frame into the chain. pFrame->Push(pThread); -#endif // !TARGET_X86 - _ASSERTE(pThread); // At this point we should be in preemptive GC mode (regardless of if it happened @@ -537,13 +483,11 @@ extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFra _ASSERTE(pThread->PreemptiveGCDisabled()); { -#ifndef TARGET_X86 if (pCMD->IsFieldCall()) { retVal = FieldCallWorker(pThread, pFrame); } else -#endif // !TARGET_X86 { IUnknown **pip = (IUnknown **)pFrame->GetPointerToArguments(); IUnknown *pUnk = (IUnknown *)*pip; @@ -555,12 +499,10 @@ extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFra } } -#ifndef TARGET_X86 // Note: the EH subsystem will handle resetting the frame chain and setting // the correct GC mode on exception. pFrame->Pop(pThread); pThread->EnablePreemptiveGC(); -#endif LOG((LF_STUBS, LL_INFO1000000, "COMToCLRWorker leave\n")); @@ -575,7 +517,6 @@ extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFra } return retVal; -#ifndef TARGET_X86 ErrorExit: if (pThread != NULL && pThread->PreemptiveGCDisabled()) pThread->EnablePreemptiveGC(); @@ -604,7 +545,6 @@ extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFra } return retVal; -#endif // TARGET_X86 } #if defined(_MSC_VER) && !defined(_DEBUG) @@ -1314,74 +1254,6 @@ void ComCall::PopulateComCallMethodDesc(ComCallMethodDesc *pCMD, DWORD *pdwStubF *pdwStubFlags = dwStubFlags; } -#ifdef TARGET_X86 -//--------------------------------------------------------- -// Creates the generic ComCall stub. -// -// Throws in case of error. -//--------------------------------------------------------- -/*static*/ -Stub* ComCall::CreateGenericComCallStub(BOOL isFieldAccess) -{ - CONTRACT (Stub*) - { - STANDARD_VM_CHECK; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - CPUSTUBLINKER sl; - CPUSTUBLINKER *psl = &sl; - - // These new CodeLabels are allocated on a - // "throwaway" heap. Do not worry about - // deallocating them if one of the allocations - // ends up throwing an OOM exception. - - CodeLabel* rgRareLabels[] = { - psl->NewCodeLabel(), - psl->NewCodeLabel() - }; - - - CodeLabel* rgRejoinLabels[] = { - psl->NewCodeLabel(), - psl->NewCodeLabel() - }; - - // Pop ComCallMethodDesc* pushed by prestub - psl->X86EmitPopReg(kEAX); - - // emit the initial prolog - // NOTE: Don't profile field accesses yet. - psl->EmitComMethodStubProlog(ComMethodFrame::GetMethodFrameVPtr(), - rgRareLabels, - rgRejoinLabels, - !isFieldAccess); - - // ******* NOTE ******** - // We now have a frame on the stack that is unproctected by an SEH handler. If we take an - // SO before getting into the target, we'll have a corrupted frame chain. In EmitComMethodStubProlog - // we probe-by-touch for 4 DWORDS to ensure that can set up the SEH handler before linking in - // the frame. So long as we don't use more than that here (currently 3 DWORDS - for the two args plus - // the return address, we are OK. If we decrement ESP more than an additional DWORD here before - // calling the target, we will need to probe farther. - - psl->X86EmitPushReg(kESI); // push frame as an ARG - psl->X86EmitPushReg(kEBX); // push ebx (push current thread as ARG) - LPVOID pTarget = isFieldAccess ? (LPVOID)FieldCallWorker : (LPVOID)COMToCLRWorker; - psl->X86EmitCall(psl->NewExternalCodeLabel(pTarget), 8); - - // emit the epilog - // NOTE: Don't profile field accesses yet. - psl->EmitSharedComMethodStubEpilog(ComMethodFrame::GetMethodFrameVPtr(), rgRareLabels, rgRejoinLabels, - ComCallMethodDesc::GetOffsetOfReturnThunk(), !isFieldAccess); - - // Process-wide stubs that never unload. - RETURN (psl->Link(SystemDomain::GetGlobalLoaderAllocator()->GetStubHeap())); -} -#endif // TARGET_X86 - //--------------------------------------------------------- // Either creates or retrieves from the cache, a stub to // invoke ComCall methods. Each call refcounts the returned stub. @@ -1399,8 +1271,6 @@ PCODE ComCall::GetComCallMethodStub(ComCallMethodDesc *pCMD) } CONTRACT_END; - SetupGenericStubs(); - // The stub style we return is to a single generic stub for method calls and to // a single generic stub for field accesses. The generic stub parameterizes // its behavior based on the ComCallMethodDesc. @@ -1419,13 +1289,7 @@ PCODE ComCall::GetComCallMethodStub(ComCallMethodDesc *pCMD) ExecutableWriterHolder addrOfILStubWriterHolder(pCMD->GetAddrOfILStubField(), sizeof(PCODE)); InterlockedCompareExchangeT(addrOfILStubWriterHolder.GetRW(), pTempILStub, NULL); -#ifdef TARGET_X86 - // Finally, we need to build a stub that represents the entire call. This - // is always generic. - RETURN (pCMD->IsFieldCall() ? g_pGenericComCallStubFields : g_pGenericComCallStub); -#else RETURN GetEEFuncEntryPoint(GenericComCallStub); -#endif } // Called both at run-time and by NGEN - generates method stub. diff --git a/src/coreclr/vm/comtoclrcall.h b/src/coreclr/vm/comtoclrcall.h index 7b26270285948..52b9d29371845 100644 --- a/src/coreclr/vm/comtoclrcall.h +++ b/src/coreclr/vm/comtoclrcall.h @@ -68,9 +68,6 @@ class ComCall // static void PopulateComCallMethodDesc(ComCallMethodDesc *pCMD, DWORD *pdwStubFlags); - // helper to create a generic stub for com calls - static Stub* CreateGenericComCallStub(BOOL isFieldAccess); - //--------------------------------------------------------- // Either creates or retrieves from the cache, a stub to // invoke com to com+ @@ -328,12 +325,6 @@ class ComCallMethodDesc return -COMMETHOD_PREPAD; } - static DWORD GetOffsetOfMethodDesc() - { - LIMITED_METHOD_CONTRACT; - return ((DWORD) offsetof(class ComCallMethodDesc, m_pMD)); - } - //get call sig PCCOR_SIGNATURE GetSig(DWORD *pcbSigSize = NULL) { diff --git a/src/coreclr/vm/dllimportcallback.h b/src/coreclr/vm/dllimportcallback.h index 0d142b2510a68..9012ef6ab0e10 100644 --- a/src/coreclr/vm/dllimportcallback.h +++ b/src/coreclr/vm/dllimportcallback.h @@ -308,12 +308,6 @@ class UMEntryThunk RETURN m_pMD; } - static DWORD GetOffsetOfMethodDesc() - { - LIMITED_METHOD_CONTRACT; - return offsetof(class UMEntryThunk, m_pMD); - } - static DWORD GetCodeOffset() { LIMITED_METHOD_CONTRACT; diff --git a/src/coreclr/vm/frames.h b/src/coreclr/vm/frames.h index b225d3aac2e57..8031a94dce557 100644 --- a/src/coreclr/vm/frames.h +++ b/src/coreclr/vm/frames.h @@ -1820,20 +1820,6 @@ class UnmanagedToManagedFrame : public Frame return m_pvDatum; } - static int GetOffsetOfDatum() - { - LIMITED_METHOD_CONTRACT; - return offsetof(UnmanagedToManagedFrame, m_pvDatum); - } - -#ifdef TARGET_X86 - static int GetOffsetOfCalleeSavedRegisters() - { - LIMITED_METHOD_CONTRACT; - return offsetof(UnmanagedToManagedFrame, m_calleeSavedRegisters); - } -#endif - int GetFrameType() { LIMITED_METHOD_DAC_CONTRACT; diff --git a/src/coreclr/vm/i386/asmconstants.h b/src/coreclr/vm/i386/asmconstants.h index d228c015e337c..396381f6c1f53 100644 --- a/src/coreclr/vm/i386/asmconstants.h +++ b/src/coreclr/vm/i386/asmconstants.h @@ -220,6 +220,12 @@ ASMCONSTANTS_C_ASSERT(CLRToCOMCallMethodDesc__m_pCLRToCOMCallInfo == offsetof(CL #define CLRToCOMCallInfo__m_pRetThunk 0x10 ASMCONSTANTS_C_ASSERT(CLRToCOMCallInfo__m_pRetThunk == offsetof(CLRToCOMCallInfo, m_pRetThunk)) +#define COMMETHOD_PREPAD_ASM 8 +ASMCONSTANTS_C_ASSERT(COMMETHOD_PREPAD_ASM == COMMETHOD_PREPAD) + +#define OFFSETOF__UnmanagedToManagedFrame__m_pvDatum 8 +ASMCONSTANTS_C_ASSERT(OFFSETOF__UnmanagedToManagedFrame__m_pvDatum == offsetof(UnmanagedToManagedFrame, m_pvDatum)) + #endif // FEATURE_COMINTEROP #define ASM__VTABLE_SLOTS_PER_CHUNK 8 diff --git a/src/coreclr/vm/i386/asmhelpers.S b/src/coreclr/vm/i386/asmhelpers.S index bd85a248b1efa..f5b24c18c477e 100644 --- a/src/coreclr/vm/i386/asmhelpers.S +++ b/src/coreclr/vm/i386/asmhelpers.S @@ -126,20 +126,6 @@ LEAF_ENTRY RestoreFPUContext, _TEXT ret 4 LEAF_END RestoreFPUContext, _TEXT -NESTED_ENTRY StubRareDisableTHROW, _TEXT, NoHandler - push eax - push edx - - push ebx // Thread - - CHECK_STACK_ALIGNMENT - call C_FUNC(StubRareDisableTHROWWorker) - - pop edx - pop eax - ret -NESTED_END StubRareDisableTHROW, _TEXT - // ------------------------------------------------------------------------------ // This helper routine enregisters the appropriate arguments and makes the // actual call. diff --git a/src/coreclr/vm/i386/asmhelpers.asm b/src/coreclr/vm/i386/asmhelpers.asm index 7586adab6590b..1f2b456a7a93b 100644 --- a/src/coreclr/vm/i386/asmhelpers.asm +++ b/src/coreclr/vm/i386/asmhelpers.asm @@ -24,10 +24,6 @@ EXTERN __imp__RtlUnwind@16:DWORD ifdef _DEBUG EXTERN _HelperMethodFrameConfirmState@20:PROC endif -ifdef FEATURE_COMINTEROP -EXTERN _StubRareDisableHRWorker@4:PROC -endif ; FEATURE_COMINTEROP -EXTERN _StubRareDisableTHROWWorker@4:PROC ifdef FEATURE_HIJACK EXTERN _OnHijackWorker@4:PROC endif ;FEATURE_HIJACK @@ -46,6 +42,7 @@ EXTERN _TheUMEntryPrestubWorker@4:PROC ifdef FEATURE_COMINTEROP EXTERN _CLRToCOMWorker@8:PROC +EXTERN _COMToCLRWorker@4:PROC endif EXTERN _ExternalMethodFixupWorker@16:PROC @@ -390,31 +387,6 @@ endif retn 8 _CallJitEHFinallyHelper@8 ENDP -ifdef FEATURE_COMINTEROP -_StubRareDisableHR proc public - push edx - - push ebx ; Thread - call _StubRareDisableHRWorker@4 - - pop edx - retn -_StubRareDisableHR ENDP -endif ; FEATURE_COMINTEROP - -_StubRareDisableTHROW proc public - push eax - push edx - - push ebx ; Thread - call _StubRareDisableTHROWWorker@4 - - pop edx - pop eax - retn -_StubRareDisableTHROW endp - - ;------------------------------------------------------------------------------ ; This helper routine enregisters the appropriate arguments and makes the ; actual call. @@ -1235,6 +1207,51 @@ _GenericCLRToCOMCallStub@0 proc public ret _GenericCLRToCOMCallStub@0 endp + +_GenericComCallStub@0 proc public + + ; Pop ComCallMethodDesc* pushed by prestub + pop eax + + ; Create UnmanagedToManagedFrame on stack + + ; push ebp-frame + push ebp + mov ebp,esp + + ; save CalleeSavedRegisters + push ebx + push esi + push edi + + push eax ; UnmanagedToManagedFrame::m_pvDatum = ComCallMethodDesc* + sub esp, (SIZEOF_GSCookie + OFFSETOF__UnmanagedToManagedFrame__m_pvDatum) + + lea eax, [esp+SIZEOF_GSCookie] + + push eax + call _COMToCLRWorker@4 + + add esp, (SIZEOF_GSCookie + OFFSETOF__UnmanagedToManagedFrame__m_pvDatum) + + ; pop the ComCallMethodDesc* + pop ecx + + ; pop CalleeSavedRegisters + pop edi + pop esi + pop ebx + pop ebp + + sub ecx, COMMETHOD_PREPAD_ASM + jmp ecx + + ; This will never be executed. It is just to help out stack-walking logic + ; which disassembles the epilog to unwind the stack. + ret + +_GenericComCallStub@0 endp + endif ; FEATURE_COMINTEROP diff --git a/src/coreclr/vm/i386/cgenx86.cpp b/src/coreclr/vm/i386/cgenx86.cpp index 773c1881ae746..b46de5a0dd969 100644 --- a/src/coreclr/vm/i386/cgenx86.cpp +++ b/src/coreclr/vm/i386/cgenx86.cpp @@ -913,27 +913,6 @@ Stub *GenerateInitPInvokeFrameHelper() RETURN psl->Link(SystemDomain::GetGlobalLoaderAllocator()->GetExecutableHeap()); } -// Disable when calling into managed code from a place that fails via Exceptions -extern "C" VOID STDCALL StubRareDisableTHROWWorker(Thread *pThread) -{ - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_TRIGGERS; - - // Do not add a CONTRACT here. We haven't set up SEH. - - // WARNING!!!! - // when we start executing here, we are actually in cooperative mode. But we - // haven't synchronized with the barrier to reentry yet. So we are in a highly - // dangerous mode. If we call managed code, we will potentially be active in - // the GC heap, even as GC's are occurring! - - // We must do the following in this order, because otherwise we would be constructing - // the exception for the abort without synchronizing with the GC. Also, we have no - // CLR SEH set up, despite the fact that we may throw a ThreadAbortException. - pThread->RareDisablePreemptiveGC(); - pThread->HandleThreadAbort(); -} - ////////////////////////////////////////////////////////////////////////////// // // JITInterface diff --git a/src/coreclr/vm/i386/stublinkerx86.cpp b/src/coreclr/vm/i386/stublinkerx86.cpp index a9167ea4227db..e1410da248692 100644 --- a/src/coreclr/vm/i386/stublinkerx86.cpp +++ b/src/coreclr/vm/i386/stublinkerx86.cpp @@ -32,12 +32,6 @@ #include "class.h" #include "stublink.inl" -#ifdef FEATURE_COMINTEROP -#include "comtoclrcall.h" -#include "runtimecallablewrapper.h" -#include "comcache.h" -#include "olevariant.h" -#endif // FEATURE_COMINTEROP #if defined(_DEBUG) && defined(STUBLINKER_GENERATES_UNWIND_INFO) #include @@ -45,10 +39,6 @@ #ifndef DACCESS_COMPILE -#ifdef FEATURE_COMINTEROP -extern "C" HRESULT __cdecl StubRareDisableHR(Thread *pThread); -#endif // FEATURE_COMINTEROP -extern "C" VOID __cdecl StubRareDisableTHROW(Thread *pThread, Frame *pFrame); #if defined(TARGET_AMD64) #if defined(_DEBUG) @@ -56,15 +46,6 @@ extern "C" VOID __cdecl DebugCheckStubUnwindInfo(); #endif // _DEBUG #endif // TARGET_AMD64 -#ifdef FEATURE_COMINTEROP -// Use a type alias as MSVC has issues parsing the pointer, the calling convention, and the declspec -// in the same signature. -// Disable ASAN here as this method uses inline assembly and touches registers that ASAN uses. -using ThreadPointer = Thread*; -ThreadPointer DISABLE_ASAN __stdcall CreateThreadBlockReturnHr(ComMethodFrame *pFrame); -#endif - - #ifdef TARGET_AMD64 @@ -2496,389 +2477,6 @@ VOID StubLinkerCPU::X86EmitCurrentThreadAllocContextFetch(X86Reg dstreg, unsigne #endif // TARGET_UNIX } -#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86) - -#if defined(PROFILING_SUPPORTED) -VOID StubLinkerCPU::EmitProfilerComCallProlog(TADDR pFrameVptr, X86Reg regFrame) -{ - STANDARD_VM_CONTRACT; - - // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD) - X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum()); - X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc()); - - // Push arguments and notify profiler - X86EmitPushImm32(COR_PRF_TRANSITION_CALL); // Reason - X86EmitPushReg(kECX); // MethodDesc* - X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerUnmanagedToManagedTransitionMD), 2*sizeof(void*)); -} - - -VOID StubLinkerCPU::EmitProfilerComCallEpilog(TADDR pFrameVptr, X86Reg regFrame) -{ - CONTRACTL - { - STANDARD_VM_CHECK; - PRECONDITION(pFrameVptr == ComMethodFrame::GetMethodFrameVPtr()); - } - CONTRACTL_END; - - // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD) - X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum()); - X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc()); - - // Push arguments and notify profiler - X86EmitPushImm32(COR_PRF_TRANSITION_RETURN); // Reason - X86EmitPushReg(kECX); // MethodDesc* - X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerManagedToUnmanagedTransitionMD), 2*sizeof(void*)); -} -#endif // PROFILING_SUPPORTED - -//======================================================================== -// Prolog for entering managed code from COM -// pushes the appropriate frame ptr -// sets up a thread and returns a label that needs to be emitted by the caller -// At the end: -// ESI will hold the pointer to the ComMethodFrame or UMThkCallFrame -// EBX will hold the result of GetThread() -// EDI will hold the previous Frame ptr - -void StubLinkerCPU::EmitComMethodStubProlog(TADDR pFrameVptr, - CodeLabel** rgRareLabels, - CodeLabel** rgRejoinLabels, - BOOL bShouldProfile) -{ - CONTRACTL - { - STANDARD_VM_CHECK; - - PRECONDITION(rgRareLabels != NULL); - PRECONDITION(rgRareLabels[0] != NULL && rgRareLabels[1] != NULL); - PRECONDITION(rgRejoinLabels != NULL); - PRECONDITION(rgRejoinLabels[0] != NULL && rgRejoinLabels[1] != NULL); - } - CONTRACTL_END; - - // push ebp ;; save callee-saved register - // push ebx ;; save callee-saved register - // push esi ;; save callee-saved register - // push edi ;; save callee-saved register - X86EmitPushEBPframe(); - - X86EmitPushReg(kEBX); - X86EmitPushReg(kESI); - X86EmitPushReg(kEDI); - - // push eax ; datum - X86EmitPushReg(kEAX); - - // push edx ;leave room for m_next (edx is an arbitrary choice) - X86EmitPushReg(kEDX); - - // push IMM32 ; push Frame vptr - X86EmitPushImmPtr((LPVOID) pFrameVptr); - - X86EmitPushImmPtr((LPVOID)GetProcessGSCookie()); - - // lea esi, [esp+4] ;; set ESI -> new frame - X86EmitEspOffset(0x8d, kESI, 4); // lea ESI, [ESP+4] - - // Emit Setup thread - EmitSetup(rgRareLabels[0]); // rareLabel for rare setup - EmitLabel(rgRejoinLabels[0]); // rejoin label for rare setup - -#ifdef PROFILING_SUPPORTED - // If profiling is active, emit code to notify profiler of transition - // Must do this before preemptive GC is disabled, so no problem if the - // profiler blocks. - if (CORProfilerTrackTransitions() && bShouldProfile) - { - EmitProfilerComCallProlog(pFrameVptr, /*Frame*/ kESI); - } -#endif // PROFILING_SUPPORTED - - //----------------------------------------------------------------------- - // Generate the inline part of disabling preemptive GC. It is critical - // that this part happen before we link in the frame. That's because - // we won't be able to unlink the frame from preemptive mode. And during - // shutdown, we cannot switch to cooperative mode under some circumstances - //----------------------------------------------------------------------- - EmitDisable(rgRareLabels[1], /*fCallIn=*/TRUE, kEBX); // rare disable gc - EmitLabel(rgRejoinLabels[1]); // rejoin for rare disable gc - - // If we take an SO after installing the new frame but before getting the exception - // handlers in place, we will have a corrupt frame stack. So probe-by-touch first for - // sufficient stack space to erect the handler. Because we know we will be touching - // that stack right away when install the handler, this probe-by-touch will not incur - // unnecessary cache misses. And this allows us to do the probe with one instruction. - - // Note that for Win64, the personality routine will handle unlinking the frame, so - // we don't need to probe in the Win64 stubs. The exception is ComToCLRWorker - // where we don't setup a personality routine. However, we push the frame inside - // that function and it is probe-protected with an entry point probe first, so we are - // OK there too. - - // We push two registers to setup the EH handler and none to setup the frame - // so probe for double that to give ourselves a small margin for error. - // mov eax, [esp+n] ;; probe for sufficient stack to setup EH - X86EmitEspOffset(0x8B, kEAX, -0x20); - // mov edi,[ebx + Thread.GetFrame()] ;; get previous frame - X86EmitIndexRegLoad(kEDI, kEBX, Thread::GetOffsetOfCurrentFrame()); - - // mov [esi + Frame.m_next], edi - X86EmitIndexRegStore(kESI, Frame::GetOffsetOfNextLink(), kEDI); - - // mov [ebx + Thread.GetFrame()], esi - X86EmitIndexRegStore(kEBX, Thread::GetOffsetOfCurrentFrame(), kESI); - -#if _DEBUG - if (Frame::ShouldLogTransitions()) - { - // call LogTransition - X86EmitPushReg(kESI); - X86EmitCall(NewExternalCodeLabel((LPVOID) Frame::LogTransition), sizeof(void*)); - } -#endif -} - -//======================================================================== -// Epilog for stubs that enter managed code from COM -// -// At this point of the stub, the state should be as follows: -// ESI holds the ComMethodFrame or UMThkCallFrame ptr -// EBX holds the result of GetThread() -// EDI holds the previous Frame ptr -// -void StubLinkerCPU::EmitComMethodStubEpilog(TADDR pFrameVptr, - CodeLabel** rgRareLabels, - CodeLabel** rgRejoinLabels, - BOOL bShouldProfile) -{ - CONTRACTL - { - STANDARD_VM_CHECK; - - PRECONDITION(rgRareLabels != NULL); - PRECONDITION(rgRareLabels[0] != NULL && rgRareLabels[1] != NULL); - PRECONDITION(rgRejoinLabels != NULL); - PRECONDITION(rgRejoinLabels[0] != NULL && rgRejoinLabels[1] != NULL); - PRECONDITION(4 == sizeof( ((Thread*)0)->m_State )); - PRECONDITION(4 == sizeof( ((Thread*)0)->m_fPreemptiveGCDisabled )); - } - CONTRACTL_END; - - EmitCheckGSCookie(kESI, UnmanagedToManagedFrame::GetOffsetOfGSCookie()); - - // mov [ebx + Thread.GetFrame()], edi ;; restore previous frame - X86EmitIndexRegStore(kEBX, Thread::GetOffsetOfCurrentFrame(), kEDI); - - // move byte ptr [ebx + Thread.m_fPreemptiveGCDisabled],0 - X86EmitOffsetModRM(0xc6, (X86Reg)0, kEBX, Thread::GetOffsetOfGCFlag()); - Emit8(0); - - // add esp, popstack - X86EmitAddEsp(sizeof(GSCookie) + UnmanagedToManagedFrame::GetOffsetOfCalleeSavedRegisters()); - - // pop edi ; restore callee-saved registers - // pop esi - // pop ebx - // pop ebp - X86EmitPopReg(kEDI); - X86EmitPopReg(kESI); - X86EmitPopReg(kEBX); - X86EmitPopReg(kEBP); - - // jmp eax //reexecute! - X86EmitR2ROp(0xff, (X86Reg)4, kEAX); - - // ret - // This will never be executed. It is just to help out stack-walking logic - // which disassembles the epilog to unwind the stack. A "ret" instruction - // indicates that no more code needs to be disassembled, if the stack-walker - // keeps on going past the previous "jmp eax". - X86EmitReturn(0); - - //----------------------------------------------------------------------- - // The out-of-line portion of disabling preemptive GC - rarely executed - //----------------------------------------------------------------------- - EmitLabel(rgRareLabels[1]); // label for rare disable gc - EmitRareDisable(rgRejoinLabels[1]); // emit rare disable gc - - //----------------------------------------------------------------------- - // The out-of-line portion of setup thread - rarely executed - //----------------------------------------------------------------------- - EmitLabel(rgRareLabels[0]); // label for rare setup thread - EmitRareSetup(rgRejoinLabels[0], /*fThrow*/ TRUE); // emit rare setup thread -} - -//--------------------------------------------------------------- -// Emit code to store the setup current Thread structure in eax. -// TRASHES eax,ecx&edx. -// RESULTS ebx = current Thread -//--------------------------------------------------------------- -VOID StubLinkerCPU::EmitSetup(CodeLabel *pForwardRef) -{ - STANDARD_VM_CONTRACT; - - X86EmitCurrentThreadFetch(kEBX, 0); - - // cmp ebx, 0 - static const BYTE b[] = { 0x83, 0xFB, 0x0}; - - EmitBytes(b, sizeof(b)); - - // jz RarePath - X86EmitCondJump(pForwardRef, X86CondCode::kJZ); - -#ifdef _DEBUG - X86EmitDebugTrashReg(kECX); - X86EmitDebugTrashReg(kEDX); -#endif -} - -VOID StubLinkerCPU::EmitRareSetup(CodeLabel *pRejoinPoint, BOOL fThrow) -{ - STANDARD_VM_CONTRACT; - - if (!fThrow) - { - X86EmitPushReg(kESI); - X86EmitCall(NewExternalCodeLabel((LPVOID) CreateThreadBlockReturnHr), sizeof(void*)); - } - else - { - X86EmitCall(NewExternalCodeLabel((LPVOID) CreateThreadBlockThrow), 0); - } - - // mov ebx,eax - Emit16(0xc389); - X86EmitNearJump(pRejoinPoint); -} - -//======================================================================== -// Epilog for stubs that enter managed code from COM -// -// On entry, ESI points to the Frame -// ESP points to below FramedMethodFrame::m_vc5Frame -// EBX hold GetThread() -// EDI holds the previous Frame - -void StubLinkerCPU::EmitSharedComMethodStubEpilog(TADDR pFrameVptr, - CodeLabel** rgRareLabels, - CodeLabel** rgRejoinLabels, - unsigned offsetRetThunk, - BOOL bShouldProfile) -{ - CONTRACTL - { - STANDARD_VM_CHECK; - - PRECONDITION(rgRareLabels != NULL); - PRECONDITION(rgRareLabels[0] != NULL && rgRareLabels[1] != NULL); - PRECONDITION(rgRejoinLabels != NULL); - PRECONDITION(rgRejoinLabels[0] != NULL && rgRejoinLabels[1] != NULL); - PRECONDITION(4 == sizeof( ((Thread*)0)->m_State )); - PRECONDITION(4 == sizeof( ((Thread*)0)->m_fPreemptiveGCDisabled )); - } - CONTRACTL_END; - - CodeLabel *NoEntryLabel; - NoEntryLabel = NewCodeLabel(); - - EmitCheckGSCookie(kESI, UnmanagedToManagedFrame::GetOffsetOfGSCookie()); - - // mov [ebx + Thread.GetFrame()], edi ;; restore previous frame - X86EmitIndexRegStore(kEBX, Thread::GetOffsetOfCurrentFrame(), kEDI); - - //----------------------------------------------------------------------- - // Generate enabling preemptive GC - //----------------------------------------------------------------------- - EmitLabel(NoEntryLabel); // need to enable preemp mode even when we fail the disable as rare disable will return in coop mode - - // move byte ptr [ebx + Thread.m_fPreemptiveGCDisabled],0 - X86EmitOffsetModRM(0xc6, (X86Reg)0, kEBX, Thread::GetOffsetOfGCFlag()); - Emit8(0); - -#ifdef PROFILING_SUPPORTED - // If profiling is active, emit code to notify profiler of transition - if (CORProfilerTrackTransitions() && bShouldProfile) - { - // Save return value - X86EmitPushReg(kEAX); - X86EmitPushReg(kEDX); - - EmitProfilerComCallEpilog(pFrameVptr, kESI); - - // Restore return value - X86EmitPopReg(kEDX); - X86EmitPopReg(kEAX); - } -#endif // PROFILING_SUPPORTED - - X86EmitAddEsp(sizeof(GSCookie) + UnmanagedToManagedFrame::GetOffsetOfDatum()); - - // pop ecx - X86EmitPopReg(kECX); // pop the MethodDesc* - - // pop edi ; restore callee-saved registers - // pop esi - // pop ebx - // pop ebp - X86EmitPopReg(kEDI); - X86EmitPopReg(kESI); - X86EmitPopReg(kEBX); - X86EmitPopReg(kEBP); - - // add ecx, offsetRetThunk - X86EmitAddReg(kECX, offsetRetThunk); - - // jmp ecx - // This will jump to the "ret cbStackArgs" instruction in COMMETHOD_PREPAD. - static const BYTE bjmpecx[] = { 0xff, 0xe1 }; - EmitBytes(bjmpecx, sizeof(bjmpecx)); - - // ret - // This will never be executed. It is just to help out stack-walking logic - // which disassembles the epilog to unwind the stack. A "ret" instruction - // indicates that no more code needs to be disassembled, if the stack-walker - // keeps on going past the previous "jmp ecx". - X86EmitReturn(0); - - //----------------------------------------------------------------------- - // The out-of-line portion of disabling preemptive GC - rarely executed - //----------------------------------------------------------------------- - EmitLabel(rgRareLabels[1]); // label for rare disable gc - EmitRareDisableHRESULT(rgRejoinLabels[1], NoEntryLabel); - - //----------------------------------------------------------------------- - // The out-of-line portion of setup thread - rarely executed - //----------------------------------------------------------------------- - EmitLabel(rgRareLabels[0]); // label for rare setup thread - EmitRareSetup(rgRejoinLabels[0],/*fThrow*/ FALSE); // emit rare setup thread -} - -#endif // defined(FEATURE_COMINTEROP) && defined(TARGET_X86) - - -#if !defined(FEATURE_STUBS_AS_IL) && defined(TARGET_X86) -VOID StubLinkerCPU::EmitCheckGSCookie(X86Reg frameReg, int gsCookieOffset) -{ - STANDARD_VM_CONTRACT; - -#ifdef _DEBUG - // cmp dword ptr[frameReg-gsCookieOffset], gsCookie - X86EmitCmpRegIndexImm32(frameReg, gsCookieOffset, GetProcessGSCookie()); - - CodeLabel * pLabel = NewCodeLabel(); - X86EmitCondJump(pLabel, X86CondCode::kJE); - - X86EmitCall(NewExternalCodeLabel((LPVOID) JIT_FailFast), 0); - - EmitLabel(pLabel); -#endif -} -#endif // !defined(FEATURE_STUBS_AS_IL) && defined(TARGET_X86) - #ifdef TARGET_X86 // This method unboxes the THIS pointer and then calls pRealMD // If it's shared code for a method in a generic value class, then also extract the vtable pointer @@ -3246,112 +2844,6 @@ VOID StubLinkerCPU::EmitUnwindInfoCheckSubfunction() #endif // defined(_DEBUG) && defined(STUBLINKER_GENERATES_UNWIND_INFO) -#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86) - -//----------------------------------------------------------------------- -// Generates the inline portion of the code to disable preemptive GC. Hopefully, -// the inline code is all that will execute most of the time. If this code -// path is entered at certain times, however, it will need to jump out to -// a separate out-of-line path which is more expensive. The "pForwardRef" -// label indicates the start of the out-of-line path. -// -// Assumptions: -// ebx = Thread -// Preserves -// all registers except ecx. -// -//----------------------------------------------------------------------- -VOID StubLinkerCPU::EmitDisable(CodeLabel *pForwardRef, BOOL fCallIn, X86Reg ThreadReg) -{ - CONTRACTL - { - STANDARD_VM_CHECK; - - PRECONDITION(4 == sizeof( ((Thread*)0)->m_fPreemptiveGCDisabled )); - PRECONDITION(4 == sizeof(g_TrapReturningThreads)); - } - CONTRACTL_END; - - // move byte ptr [ebx + Thread.m_fPreemptiveGCDisabled],1 - X86EmitOffsetModRM(0xc6, (X86Reg)0, ThreadReg, Thread::GetOffsetOfGCFlag()); - Emit8(1); - - // cmp dword ptr g_TrapReturningThreads, 0 - Emit16(0x3d83); - EmitPtr((void *)&g_TrapReturningThreads); - Emit8(0); - - // jnz RarePath - X86EmitCondJump(pForwardRef, X86CondCode::kJNZ); - -#ifdef _DEBUG - if (ThreadReg != kECX) - X86EmitDebugTrashReg(kECX); -#endif - -} - - -//----------------------------------------------------------------------- -// Generates the out-of-line portion of the code to disable preemptive GC. -// After the work is done, the code jumps back to the "pRejoinPoint" -// which should be emitted right after the inline part is generated. However, -// if we cannot execute managed code at this time, an exception is thrown -// which cannot be caught by managed code. -// -// Assumptions: -// ebx = Thread -// Preserves -// all registers except ecx, eax. -// -//----------------------------------------------------------------------- -VOID StubLinkerCPU::EmitRareDisable(CodeLabel *pRejoinPoint) -{ - STANDARD_VM_CONTRACT; - - X86EmitCall(NewExternalCodeLabel((LPVOID) StubRareDisableTHROW), 0); - -#ifdef _DEBUG - X86EmitDebugTrashReg(kECX); -#endif - X86EmitNearJump(pRejoinPoint); -} - -//----------------------------------------------------------------------- -// Generates the out-of-line portion of the code to disable preemptive GC. -// After the work is done, the code normally jumps back to the "pRejoinPoint" -// which should be emitted right after the inline part is generated. However, -// if we cannot execute managed code at this time, an HRESULT is returned -// via the ExitPoint. -// -// Assumptions: -// ebx = Thread -// Preserves -// all registers except ecx, eax. -// -//----------------------------------------------------------------------- -VOID StubLinkerCPU::EmitRareDisableHRESULT(CodeLabel *pRejoinPoint, CodeLabel *pExitPoint) -{ - STANDARD_VM_CONTRACT; - - X86EmitCall(NewExternalCodeLabel((LPVOID) StubRareDisableHR), 0); - -#ifdef _DEBUG - X86EmitDebugTrashReg(kECX); -#endif - - // test eax, eax ;; test the result of StubRareDisableHR - Emit16(0xc085); - - // JZ pRejoinPoint - X86EmitCondJump(pRejoinPoint, X86CondCode::kJZ); - - X86EmitNearJump(pExitPoint); -} - -#endif // defined(FEATURE_COMINTEROP) && defined(TARGET_X86) - - VOID StubLinkerCPU::EmitShuffleThunk(ShuffleEntry *pShuffleEntryArray) { STANDARD_VM_CONTRACT; @@ -3590,74 +3082,6 @@ VOID StubLinkerCPU::EmitShuffleThunk(ShuffleEntry *pShuffleEntryArray) #endif // TARGET_AMD64 } - -#if !defined(FEATURE_STUBS_AS_IL) - -#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86) - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning (disable : 4740) // There is inline asm code in this function, which disables - // global optimizations. -#pragma warning (disable : 4731) -#endif // _MSC_VER -ThreadPointer __stdcall CreateThreadBlockReturnHr(ComMethodFrame *pFrame) -{ - - WRAPPER_NO_CONTRACT; - - HRESULT hr = S_OK; - - // This means that a thread is FIRST coming in from outside the EE. - Thread* pThread = SetupThreadNoThrow(&hr); - - if (pThread == NULL) { - // Unwind stack, and return hr - // NOTE: assumes __stdcall - // Note that this code does not handle the rare COM signatures that do not return HRESULT - // compute the callee pop stack bytes - UINT numArgStackBytes = pFrame->GetNumCallerStackBytes(); - unsigned frameSize = sizeof(Frame) + sizeof(LPVOID); - LPBYTE iEsp = ((LPBYTE)pFrame) + ComMethodFrame::GetOffsetOfCalleeSavedRegisters(); - - // Let ASAN that we aren't going to return so it can do some cleanup - __asan_handle_no_return(); - - __asm - { - mov eax, hr - mov edx, numArgStackBytes - //***************************************** - // reset the stack pointer - // none of the locals above can be used in the asm below - // if we wack the stack pointer - mov esp, iEsp - // pop callee saved registers - pop edi - pop esi - pop ebx - pop ebp - pop ecx ; //return address - // pop the callee cleanup stack args - add esp, edx ;// callee cleanup of args - jmp ecx; // jump to the address to continue execution - - // We will never get here. This "ret" is just so that code-disassembling - // profilers know to stop disassembling any further - ret - } - } - - return pThread; -} -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - -#endif // FEATURE_COMINTEROP && TARGET_X86 - -#endif // !FEATURE_STUBS_AS_IL - #endif // !DACCESS_COMPILE #ifdef HAS_THISPTR_RETBUF_PRECODE diff --git a/src/coreclr/vm/i386/stublinkerx86.h b/src/coreclr/vm/i386/stublinkerx86.h index 443f3c6685213..dd627aafe0ce9 100644 --- a/src/coreclr/vm/i386/stublinkerx86.h +++ b/src/coreclr/vm/i386/stublinkerx86.h @@ -323,19 +323,6 @@ class StubLinkerCPU : public StubLinker #endif } -#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86) - VOID EmitDisable(CodeLabel *pForwardRef, BOOL fCallIn, X86Reg ThreadReg); - VOID EmitRareDisable(CodeLabel *pRejoinPoint); - VOID EmitRareDisableHRESULT(CodeLabel *pRejoinPoint, CodeLabel *pExitPoint); - - VOID EmitSetup(CodeLabel *pForwardRef); - VOID EmitRareSetup(CodeLabel* pRejoinPoint, BOOL fThrow); -#endif // FEATURE_COMINTEROP && TARGET_X86 - -#ifndef FEATURE_STUBS_AS_IL - VOID EmitCheckGSCookie(X86Reg frameReg, int gsCookieOffset); -#endif // !FEATURE_STUBS_AS_IL - #ifdef TARGET_X86 VOID EmitUnboxMethodStub(MethodDesc* pRealMD); #endif // TARGET_X86 @@ -349,31 +336,6 @@ class StubLinkerCPU : public StubLinker #endif // FEATURE_SHARE_GENERIC_CODE VOID EmitComputedInstantiatingMethodStub(MethodDesc* pSharedMD, struct ShuffleEntry *pShuffleEntryArray, void* extraArg); -#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86) - -#if defined(PROFILING_SUPPORTED) - // These are used to emit calls to notify the profiler of transitions in and out of - // managed code through COM->COM+ interop or N/Direct - VOID EmitProfilerComCallProlog(TADDR pFrameVptr, X86Reg regFrame); - VOID EmitProfilerComCallEpilog(TADDR pFrameVptr, X86Reg regFrame); -#endif // PROFILING_SUPPORTED - - void EmitComMethodStubProlog(TADDR pFrameVptr, CodeLabel** rgRareLabels, - CodeLabel** rgRejoinLabels, BOOL bShouldProfile); - - void EmitComMethodStubEpilog(TADDR pFrameVptr, CodeLabel** rgRareLabels, - CodeLabel** rgRejoinLabels, BOOL bShouldProfile); - - //======================================================================== - // shared Epilog for stubs that enter managed code from COM - // uses a return thunk within the method desc - void EmitSharedComMethodStubEpilog(TADDR pFrameVptr, - CodeLabel** rgRareLabels, - CodeLabel** rgRejoinLabels, - unsigned offsetReturnThunk, - BOOL bShouldProfile); -#endif // FEATURE_COMINTEROP && TARGET_X86 - //=========================================================================== // Emits code to adjust for a static delegate target. VOID EmitShuffleThunk(struct ShuffleEntry *pShuffleEntryArray);