PTR_CORCOMPILE_EXCEPTION_LOOKUP_TABLE_ENTRY;
typedef DPTR(struct CORCOMPILE_EXCEPTION_CLAUSE)
PTR_CORCOMPILE_EXCEPTION_CLAUSE;
-typedef DPTR(struct CORCOMPILE_EXTERNAL_METHOD_THUNK)
- PTR_CORCOMPILE_EXTERNAL_METHOD_THUNK;
typedef DPTR(struct CORCOMPILE_EXTERNAL_METHOD_DATA_ENTRY)
PTR_CORCOMPILE_EXTERNAL_METHOD_DATA_ENTRY;
typedef DPTR(struct CORCOMPILE_IMPORT_SECTION)
return ((((SIZE_T)(fixup)) & CORCOMPILE_TOKEN_TAG) == CORCOMPILE_TOKEN_TAG);
}
-/*********************************************************************************/
-
-#if defined(TARGET_X86) || defined(TARGET_AMD64)
-
-#define _PRECODE_EXTERNAL_METHOD_THUNK 0x41
- struct CORCOMPILE_EXTERNAL_METHOD_THUNK
- {
- BYTE callJmp[5]; // Call/Jmp Pc-Rel32
- BYTE precodeType; // 0x41 _PRECODE_EXTERNAL_METHOD_THUNK
- WORD padding;
- };
-
-#elif defined(TARGET_ARM)
-
- struct CORCOMPILE_EXTERNAL_METHOD_THUNK
- {
- // Array of words to do the following:
- //
- // mov r12, pc ; Save the current address relative to which we will get GCRef bitmap and address to patch.
- // ldr pc, [pc, #4] ; Load the target address. Initially it will point to the helper stub that will patch it
- // ; to point to the actual target on the first run.
- WORD m_rgCode[3];
-
- WORD m_padding;
-
- // The target address - initially, this will point to ExternalMethodFixupStub.
- // Post patchup by the stub, it will point to the actual method body.
- PCODE m_pTarget;
- };
-
-#elif defined(TARGET_ARM64)
- struct CORCOMPILE_EXTERNAL_METHOD_THUNK
- {
- // Array of words to do the following:
- // adr x12, #0 ; Save the current address relative to which we will get slot ID and address to patch.
- // ldr x10, [x12, #16] ; Load the target address.
- // br x10 ; Jump to the target
- DWORD m_rgCode[3];
-
- DWORD m_padding; //aligning stack to 16 bytes
-
- // The target address - initially, this will point to ExternalMethodFixupStub.
- // Post patchup by the stub, it will point to the actual method body.
- PCODE m_pTarget;
- };
-
-#endif
-
//
// GCRefMap blob starts with DWORDs lookup index of relative offsets into the blob. This lookup index is used to limit amount
// of linear scanning required to find entry in the GCRefMap. The size of this lookup index is
CORINFO_HELP_ARE_TYPES_EQUIVALENT, // Check whether two TypeHandles (native structure pointers) are equivalent
CORINFO_HELP_VIRTUAL_FUNC_PTR, // look up a virtual method at run-time
- //CORINFO_HELP_VIRTUAL_FUNC_PTR_LOG, // look up a virtual method at run-time, with IBC logging
// Not a real helpers. Instead of taking handle arguments, these helpers point to a small stub that loads the handle argument and calls the static helper.
CORINFO_HELP_READYTORUN_NEW,
CORINFO_HELP_READYTORUN_DELEGATE_CTOR,
CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE,
- CORINFO_HELP_EE_PRESTUB, // Not real JIT helper. Used in native images.
-
- CORINFO_HELP_EE_PRECODE_FIXUP, // Not real JIT helper. Used for Precode fixup in native images.
- CORINFO_HELP_EE_PINVOKE_FIXUP, // Not real JIT helper. Used for PInvoke target fixup in native images.
- CORINFO_HELP_EE_VSD_FIXUP, // Not real JIT helper. Used for VSD cell fixup in native images.
- CORINFO_HELP_EE_EXTERNAL_FIXUP, // Not real JIT helper. Used for to fixup external method thunks in native images.
- CORINFO_HELP_EE_VTABLE_FIXUP, // Not real JIT helper. Used for inherited vtable slot fixup in native images.
-
- CORINFO_HELP_EE_REMOTING_THUNK, // Not real JIT helper. Used for remoting precode in native images.
-
CORINFO_HELP_EE_PERSONALITY_ROUTINE,// Not real JIT helper. Used in native images.
CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET,// Not real JIT helper. Used in native images to detect filter funclets.
#define GUID_DEFINED
#endif // !GUID_DEFINED
-constexpr GUID JITEEVersionIdentifier = { /* 80a6aaf7-7fb3-44b2-8fe5-95fd47308798 */
- 0x80a6aaf7,
- 0x7fb3,
- 0x44b2,
- {0x8f, 0xe5, 0x95, 0xfd, 0x47, 0x30, 0x87, 0x98}
+constexpr GUID JITEEVersionIdentifier = { /* bcc99ca6-5291-4cc0-a5d9-2758456053f3 */
+ 0xbcc99ca6,
+ 0x5291,
+ 0x4cc0,
+ { 0xa5, 0xd9, 0x27, 0x58, 0x45, 0x60, 0x53, 0xf3 }
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
JITHELPER(CORINFO_HELP_ARE_TYPES_EQUIVALENT, NULL, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_VIRTUAL_FUNC_PTR, JIT_VirtualFunctionPointer, CORINFO_HELP_SIG_4_STACK)
- //JITHELPER(CORINFO_HELP_VIRTUAL_FUNC_PTR_LOG,JIT_VirtualFunctionPointerLogging)
JITHELPER(CORINFO_HELP_READYTORUN_NEW, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_NEWARR_1, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_DELEGATE_CTOR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
- JITHELPER(CORINFO_HELP_EE_PRESTUB, ThePreStub, CORINFO_HELP_SIG_NO_ALIGN_STUB)
-
-#if defined(HAS_FIXUP_PRECODE)
- JITHELPER(CORINFO_HELP_EE_PRECODE_FIXUP, PrecodeFixupThunk, CORINFO_HELP_SIG_NO_ALIGN_STUB)
-#else
- JITHELPER(CORINFO_HELP_EE_PRECODE_FIXUP, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
-#endif
-
- JITHELPER(CORINFO_HELP_EE_PINVOKE_FIXUP, NDirectImportThunk, CORINFO_HELP_SIG_NO_ALIGN_STUB)
-
- JITHELPER(CORINFO_HELP_EE_VSD_FIXUP, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
- JITHELPER(CORINFO_HELP_EE_EXTERNAL_FIXUP, ExternalMethodFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB)
- JITHELPER(CORINFO_HELP_EE_VTABLE_FIXUP, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
-
- JITHELPER(CORINFO_HELP_EE_REMOTING_THUNK, NULL, CORINFO_HELP_SIG_UNDEF)
-
-// We do not need this to be saved in ngen images on Mac64 since the exception dispatch
-// is not done via the OS and thus, there wont be any need to know this information
-// by anyone.
#ifdef FEATURE_EH_FUNCLETS
JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE, ProcessCLRException, CORINFO_HELP_SIG_UNDEF)
JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET, ProcessCLRException,CORINFO_HELP_SIG_UNDEF)
CORINFO_HELP_ARE_TYPES_EQUIVALENT, // Check whether two TypeHandles (native structure pointers) are equivalent
CORINFO_HELP_VIRTUAL_FUNC_PTR, // look up a virtual method at run-time
- //CORINFO_HELP_VIRTUAL_FUNC_PTR_LOG, // look up a virtual method at run-time, with IBC logging
// Not a real helpers. Instead of taking handle arguments, these helpers point to a small stub that loads the handle argument and calls the static helper.
CORINFO_HELP_READYTORUN_NEW,
CORINFO_HELP_READYTORUN_DELEGATE_CTOR,
CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE,
- CORINFO_HELP_EE_PRESTUB, // Not real JIT helper. Used in native images.
-
- CORINFO_HELP_EE_PRECODE_FIXUP, // Not real JIT helper. Used for Precode fixup in native images.
- CORINFO_HELP_EE_PINVOKE_FIXUP, // Not real JIT helper. Used for PInvoke target fixup in native images.
- CORINFO_HELP_EE_VSD_FIXUP, // Not real JIT helper. Used for VSD cell fixup in native images.
- CORINFO_HELP_EE_EXTERNAL_FIXUP, // Not real JIT helper. Used for to fixup external method thunks in native images.
- CORINFO_HELP_EE_VTABLE_FIXUP, // Not real JIT helper. Used for inherited vtable slot fixup in native images.
-
- CORINFO_HELP_EE_REMOTING_THUNK, // Not real JIT helper. Used for remoting precode in native images.
-
CORINFO_HELP_EE_PERSONALITY_ROUTINE,// Not real JIT helper. Used in native images.
CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET,// Not real JIT helper. Used in native images to detect filter funclets.
extern DynamicHelperWorker:proc
endif
-;============================================================================================
-;; EXTERN_C VOID __stdcall ExternalMethodFixupStub()
-
-NESTED_ENTRY ExternalMethodFixupStub, _TEXT, ProcessCLRException
-
- PROLOG_WITH_TRANSITION_BLOCK 0, 8, rdx
-
- lea rcx, [rsp + __PWTB_TransitionBlock] ; pTransitionBlock
- sub rdx, 5 ; pThunk
- mov r8, 0 ; sectionIndex
- mov r9, 0 ; pModule
-
- call ExternalMethodFixupWorker
-
- EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
-PATCH_LABEL ExternalMethodFixupPatchLabel
- TAILJMP_RAX
-
-NESTED_END ExternalMethodFixupStub, _TEXT
-
-
ifdef FEATURE_READYTORUN
NESTED_ENTRY DelayLoad_MethodCall, _TEXT
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- ; Share the patch label
- jmp ExternalMethodFixupPatchLabel
+PATCH_LABEL ExternalMethodFixupPatchLabel
+ TAILJMP_RAX
NESTED_END DelayLoad_MethodCall, _TEXT
#include "unixasmmacros.inc"
#include "asmconstants.h"
-//============================================================================================
-// EXTERN_C VOID __stdcall ExternalMethodFixupStub()
-
-NESTED_ENTRY ExternalMethodFixupStub, _TEXT, NoHandler
-
- PROLOG_WITH_TRANSITION_BLOCK 0, 8, rsi, 0, 0
-
- lea rdi, [rsp + __PWTB_TransitionBlock] // pTransitionBlock
- sub rsi, 5 // pThunk
- mov rdx, 0 // sectionIndex
- mov rcx, 0 // pModule
-
- call C_FUNC(ExternalMethodFixupWorker)
-
- EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
-PATCH_LABEL ExternalMethodFixupPatchLabel
- TAILJMP_RAX
-
-NESTED_END ExternalMethodFixupStub, _TEXT
-
#ifdef FEATURE_READYTORUN
NESTED_ENTRY DelayLoad_MethodCall, _TEXT, NoHandler
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- // Share the patch label
- jmp C_FUNC(ExternalMethodFixupPatchLabel)
+PATCH_LABEL ExternalMethodFixupPatchLabel
+ TAILJMP_RAX
NESTED_END DelayLoad_MethodCall, _TEXT
NESTED_END stackProbe, _TEXT
//------------------------------------------------
-// ExternalMethodFixupStub
-//
-// In NGEN images, calls to cross-module external methods initially
-// point to a jump thunk that calls into the following function that will
-// call into a VM helper. The VM helper is responsible for patching up the
-// thunk, upon executing the precode, so that all subsequent calls go directly
-// to the actual method body.
-//
-// This is done lazily for performance reasons.
-//
-// On entry:
-//
-// R12 = Address of thunk + 4
-
- NESTED_ENTRY ExternalMethodFixupStub, _TEXT, NoHandler
-
- PROLOG_WITH_TRANSITION_BLOCK
-
- add r0, sp, #__PWTB_TransitionBlock // pTransitionBlock
-
- // Adjust (read comment above for details) and pass the address of the thunk
- sub r1, r12, #4 // pThunk
-
- mov r2, #0 // sectionIndex
- mov r3, #0 // pModule
- bl C_FUNC(ExternalMethodFixupWorker)
-
- // mov the address we patched to in R12 so that we can tail call to it
- mov r12, r0
-
- EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- PATCH_LABEL ExternalMethodFixupPatchLabel
- bx r12
-
- NESTED_END ExternalMethodFixupStub, _TEXT
-
-//------------------------------------------------
// JIT_RareDisableHelper
//
// The JIT expects this helper to preserve registers used for return values
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- // Share the patch label
- b C_FUNC(ExternalMethodFixupPatchLabel)
+ PATCH_LABEL ExternalMethodFixupPatchLabel
+ bx r12
NESTED_END DelayLoad_MethodCall_FakeProlog, _TEXT
NESTED_END
;------------------------------------------------
-; ExternalMethodFixupStub
-;
-; In NGEN images, calls to cross-module external methods initially
-; point to a jump thunk that calls into the following function that will
-; call into a VM helper. The VM helper is responsible for patching up the
-; thunk, upon executing the precode, so that all subsequent calls go directly
-; to the actual method body.
-;
-; This is done lazily for performance reasons.
-;
-; On entry:
-;
-; R12 = Address of thunk + 4
-
- NESTED_ENTRY ExternalMethodFixupStub
-
- PROLOG_WITH_TRANSITION_BLOCK
-
- add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
-
- ; Adjust (read comment above for details) and pass the address of the thunk
- sub r1, r12, #4 ; pThunk
-
- mov r2, #0 ; sectionIndex
- mov r3, #0 ; pModule
- bl ExternalMethodFixupWorker
-
- ; mov the address we patched to in R12 so that we can tail call to it
- mov r12, r0
-
- EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- PATCH_LABEL ExternalMethodFixupPatchLabel
- EPILOG_BRANCH_REG r12
-
- NESTED_END
-
-;------------------------------------------------
; JIT_RareDisableHelper
;
; The JIT expects this helper to preserve registers used for return values
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- ; Share the patch label
- EPILOG_BRANCH ExternalMethodFixupPatchLabel
+ PATCH_LABEL ExternalMethodFixupPatchLabel
+ EPILOG_BRANCH_REG r12
NESTED_END
ret lr
LEAF_END JIT_PatchedCodeLast, _TEXT
-//------------------------------------------------
-// ExternalMethodFixupStub
-//
-// In NGEN images, calls to cross-module external methods initially
-// point to a jump thunk that calls into the following function that will
-// call into a VM helper. The VM helper is responsible for patching up the
-// thunk, upon executing the precode, so that all subsequent calls go directly
-// to the actual method body.
-//
-// This is done lazily for performance reasons.
-//
-// On entry:
-//
-// x12 = Address of thunk
-
-NESTED_ENTRY ExternalMethodFixupStub, _TEXT, NoHandler
-
- PROLOG_WITH_TRANSITION_BLOCK
-
- add x0, sp, #__PWTB_TransitionBlock // pTransitionBlock
- mov x1, x12 // pThunk
- mov x2, #0 // sectionIndex
- mov x3, #0 // pModule
-
- bl C_FUNC(ExternalMethodFixupWorker)
-
- // mov the address we patched to in x12 so that we can tail call to it
- mov x12, x0
-
- EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- PATCH_LABEL ExternalMethodFixupPatchLabel
- EPILOG_BRANCH_REG x12
-
-NESTED_END ExternalMethodFixupStub, _TEXT
-
// void SinglecastDelegateInvokeStub(Delegate *pThis)
LEAF_ENTRY SinglecastDelegateInvokeStub, _TEXT
cmp x0, #0
mov x12, x0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- // Share patch label
- b C_FUNC(ExternalMethodFixupPatchLabel)
+ PATCH_LABEL ExternalMethodFixupPatchLabel
+ EPILOG_BRANCH_REG x12
NESTED_END DelayLoad_MethodCall_FakeProlog, _TEXT
ret lr
LEAF_END
-;------------------------------------------------
-; ExternalMethodFixupStub
-;
-; In NGEN images, calls to cross-module external methods initially
-; point to a jump thunk that calls into the following function that will
-; call into a VM helper. The VM helper is responsible for patching up the
-; thunk, upon executing the precode, so that all subsequent calls go directly
-; to the actual method body.
-;
-; This is done lazily for performance reasons.
-;
-; On entry:
-;
-; x12 = Address of thunk
-
- NESTED_ENTRY ExternalMethodFixupStub
-
- PROLOG_WITH_TRANSITION_BLOCK
-
- add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
- mov x1, x12 ; pThunk
- mov x2, #0 ; sectionIndex
- mov x3, #0 ; pModule
-
- bl ExternalMethodFixupWorker
-
- ; mov the address we patched to in x12 so that we can tail call to it
- mov x12, x0
-
- EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- PATCH_LABEL ExternalMethodFixupPatchLabel
- EPILOG_BRANCH_REG x12
-
- NESTED_END
-
; void SinglecastDelegateInvokeStub(Delegate *pThis)
LEAF_ENTRY SinglecastDelegateInvokeStub
cmp x0, #0
mov x12, x0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
- ; Share patch label
- b ExternalMethodFixupPatchLabel
+ PATCH_LABEL ExternalMethodFixupPatchLabel
+ EPILOG_BRANCH_REG x12
+
NESTED_END
MACRO
struct EE_ILEXCEPTION_CLAUSE;
struct TransitionBlock;
struct VASigCookie;
-struct CORCOMPILE_EXTERNAL_METHOD_THUNK;
class ComPlusCallMethodDesc;
#include <cgencpu.h>
jmp C_FUNC(GenericPInvokeCalliHelper)
LEAF_END GenericPInvokeCalliHelper, _TEXT
-// ==========================================================================
-NESTED_ENTRY ExternalMethodFixupStub, _TEXT_ NoHandler
- // pop off the return address to the stub
- // leaving the actual caller's return address on top of the stack
- pop eax
-
- STUB_PROLOG
-
- mov esi, esp
-
- // EAX is return address into CORCOMPILE_EXTERNAL_METHOD_THUNK. Subtract 5 to get start address.
- sub eax, 5
-
-.att_syntax
- pushl $0
- pushl $0
-.intel_syntax noprefix
-
- push eax
-
- // pTransitionBlock
- push esi
-
- call C_FUNC(ExternalMethodFixupWorker)
-
- // eax now contains replacement stub. PreStubWorker will never return
- // NULL (it throws an exception if stub creation fails.)
-
- // From here on, mustn't trash eax
-
- STUB_EPILOG
-
-PATCH_LABEL ExternalMethodFixupPatchLabel
- // Tailcall target
- jmp eax
-
- // This will never be executed. It is just to help out stack-walking logic
- // which disassembles the epilog to unwind the stack.
- ret
-NESTED_END ExternalMethodFixupStub, _TEXT
-
#ifdef FEATURE_READYTORUN
NESTED_ENTRY DynamicHelperArgsStub, _TEXT, NoHandler
.cfi_def_cfa_offset 16
STUB_EPILOG
- // Share the patch label
- jmp C_FUNC(ExternalMethodFixupPatchLabel)
+PATCH_LABEL ExternalMethodFixupPatchLabel
+ // Tailcall target
+ jmp eax
// This will never be executed. It is just to help out stack-walking logic
// which disassembles the epilog to unwind the stack.
EXTERN _VarargPInvokeStubWorker@12:PROC
EXTERN _GenericPInvokeCalliStubWorker@12:PROC
-ifndef FEATURE_CORECLR
-EXTERN _CopyCtorCallStubWorker@4:PROC
-endif
-
EXTERN _PreStubWorker@8:PROC
EXTERN _TheUMEntryPrestubWorker@4:PROC
endif ; FEATURE_COMINTEROP
-ifndef FEATURE_CORECLR
-
-;==========================================================================
-; This is small stub whose purpose is to record current stack pointer and
-; call CopyCtorCallStubWorker to invoke copy constructors and destructors
-; as appropriate. This stub operates on arguments already pushed to the
-; stack by JITted IL stub and must not create a new frame, i.e. it must tail
-; call to the target for it to see the arguments that copy ctors have been
-; called on.
-;
-_CopyCtorCallStub@0 proc public
- ; there may be an argument in ecx - save it
- push ecx
-
- ; push pointer to arguments
- lea edx, [esp + 8]
- push edx
-
- call _CopyCtorCallStubWorker@4
-
- ; restore ecx and tail call to the target
- pop ecx
- jmp eax
-_CopyCtorCallStub@0 endp
-
-endif ; !FEATURE_CORECLR
-
-;==========================================================================
-_ExternalMethodFixupStub@0 proc public
-
- pop eax ; pop off the return address to the stub
- ; leaving the actual caller's return address on top of the stack
-
- STUB_PROLOG
-
- mov esi, esp
-
- ; EAX is return address into CORCOMPILE_EXTERNAL_METHOD_THUNK. Subtract 5 to get start address.
- sub eax, 5
-
- push 0
- push 0
-
- push eax
-
- ; pTransitionBlock
- push esi
-
- call _ExternalMethodFixupWorker@16
-
- ; eax now contains replacement stub. PreStubWorker will never return
- ; NULL (it throws an exception if stub creation fails.)
-
- ; From here on, mustn't trash eax
-
- STUB_EPILOG
-
-_ExternalMethodFixupPatchLabel@0:
-public _ExternalMethodFixupPatchLabel@0
-
- ; Tailcall target
- jmp eax
-
- ; This will never be executed. It is just to help out stack-walking logic
- ; which disassembles the epilog to unwind the stack.
- ret
-
-_ExternalMethodFixupStub@0 endp
-
ifdef FEATURE_READYTORUN
;==========================================================================
_DelayLoad_MethodCall@0 proc public
STUB_EPILOG
- ; Share the patch label
- jmp _ExternalMethodFixupPatchLabel@0
+_ExternalMethodFixupPatchLabel@0:
+public _ExternalMethodFixupPatchLabel@0
+
+ ; Tailcall target
+ jmp eax
; This will never be executed. It is just to help out stack-walking logic
; which disassembles the epilog to unwind the stack.
}
#endif //HAS_FIXUP_PRECODE
- if (pImportSection->Flags & CORCOMPILE_IMPORT_FLAGS_CODE)
- {
- CORCOMPILE_EXTERNAL_METHOD_THUNK * pThunk = (CORCOMPILE_EXTERNAL_METHOD_THUNK *)pIndirection;
-
-#if defined(TARGET_X86) || defined(TARGET_AMD64)
- INT64 oldValue = *(INT64*)pThunk;
- BYTE* pOldValue = (BYTE*)&oldValue;
-
- if (pOldValue[0] == X86_INSTR_CALL_REL32)
- {
- INT64 newValue = oldValue;
- BYTE* pNewValue = (BYTE*)&newValue;
- pNewValue[0] = X86_INSTR_JMP_REL32;
-
- *(INT32 *)(pNewValue+1) = rel32UsingJumpStub((INT32*)(&pThunk->callJmp[1]), pCode, pMD, NULL);
-
- _ASSERTE(IS_ALIGNED((size_t)pThunk, sizeof(INT64)));
- ExecutableWriterHolder<INT64> thunkWriterHolder((INT64*)pThunk, sizeof(INT64));
- FastInterlockCompareExchangeLong(thunkWriterHolder.GetRW(), newValue, oldValue);
-
- FlushInstructionCache(GetCurrentProcess(), pThunk, 8);
- }
-#elif defined(TARGET_ARM) || defined(TARGET_ARM64)
- // Patchup the thunk to point to the actual implementation of the cross module external method
- pThunk->m_pTarget = pCode;
-
- #if defined(TARGET_ARM)
- // ThumbBit must be set on the target address
- _ASSERTE(pCode & THUMB_CODE);
- #endif
-#else
- PORTABILITY_ASSERT("ExternalMethodFixupWorker");
-#endif
- }
- else
- {
- *(TADDR *)pIndirection = pCode;
- }
+ _ASSERTE((pImportSection->Flags & CORCOMPILE_IMPORT_FLAGS_CODE) == 0);
+ *(TADDR *)pIndirection = pCode;
return pCode;
}
}
_ASSERTE(pImportSection != NULL);
- COUNT_T index;
- if (pImportSection->Flags & CORCOMPILE_IMPORT_FLAGS_CODE)
- {
- _ASSERTE(pImportSection->EntrySize == sizeof(CORCOMPILE_EXTERNAL_METHOD_THUNK));
- index = (rva - pImportSection->Section.VirtualAddress) / sizeof(CORCOMPILE_EXTERNAL_METHOD_THUNK);
- }
- else
- {
- _ASSERTE(pImportSection->EntrySize == sizeof(TADDR));
- index = (rva - pImportSection->Section.VirtualAddress) / sizeof(TADDR);
- }
+ _ASSERTE((pImportSection->Flags & CORCOMPILE_IMPORT_FLAGS_CODE) == 0);
+ _ASSERTE(pImportSection->EntrySize == sizeof(TADDR));
+ COUNT_T index = (rva - pImportSection->Section.VirtualAddress) / sizeof(TADDR);
PTR_DWORD pSignatures = dac_cast<PTR_DWORD>(pNativeImage->GetRvaData(pImportSection->Signatures));