Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -3063,7 +3063,8 @@ class ICorDynamicInfo : public ICorStaticInfo
// return the native entry point to an EE helper (see CorInfoHelpFunc)
virtual void* getHelperFtn (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the JIT going to use both the code pointer and the method handle when callling this method with non-null pMethod?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the JIT going to use both the code pointer and the method handle when callling this method with non-null pMethod?

No, are you implying that it's better to have a separate API?

Copy link
Member

@jkotas jkotas Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not have to be a separate API. It can be one API with two optional out args. Using ppIndirection to indicate whether you are interested in the actual entrypoint would look odd. I am thinking something like this may be the best shape:

void getHelperFtn(CorInfoHelpFunc ftnNum, 
    CORINFO_CONST_LOOKUP* addr, // optional [OUT]
    CORINFO_METHOD_HANDLE* method) // optional [OUT]

CorInfoHelpFunc ftnNum,
void **ppIndirection = NULL
void **ppIndirection = NULL,
CORINFO_METHOD_HANDLE* pMethod = NULL
) = 0;

// return a callable address of the function (native code). This function
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/inc/icorjitinfoimpl_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ int32_t* getAddrOfCaptureThreadGlobal(

void* getHelperFtn(
CorInfoHelpFunc ftnNum,
void** ppIndirection) override;
void** ppIndirection,
CORINFO_METHOD_HANDLE* pMethod) override;

void getFunctionEntryPoint(
CORINFO_METHOD_HANDLE ftn,
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID;
#define GUID_DEFINED
#endif // !GUID_DEFINED

constexpr GUID JITEEVersionIdentifier = { /* 64146448-11b1-4f94-b1f2-edce91fbcb33 */
0x64146448,
0x11b1,
0x4f94,
{0xb1, 0xf2, 0xed, 0xce, 0x91, 0xfb, 0xcb, 0x33}
constexpr GUID JITEEVersionIdentifier = { /* 9bd31e12-c91e-4574-bfed-c1a03b68c2e0 */
0x9bd31e12,
0xc91e,
0x4574,
{0xbf, 0xed, 0xc1, 0xa0, 0x3b, 0x68, 0xc2, 0xe0}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 3 additions & 2 deletions src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,10 +1272,11 @@ int32_t* WrapICorJitInfo::getAddrOfCaptureThreadGlobal(

void* WrapICorJitInfo::getHelperFtn(
CorInfoHelpFunc ftnNum,
void** ppIndirection)
void** ppIndirection,
CORINFO_METHOD_HANDLE* pMethod)
{
API_ENTER(getHelperFtn);
void* temp = wrapHnd->getHelperFtn(ftnNum, ppIndirection);
void* temp = wrapHnd->getHelperFtn(ftnNum, ppIndirection, pMethod);
API_LEAVE(getHelperFtn);
return temp;
}
Expand Down
28 changes: 16 additions & 12 deletions src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3531,25 +3531,29 @@ private void getFpStructLowering(CORINFO_CLASS_STRUCT_* structHnd, ref CORINFO_F
private uint getThreadTLSIndex(ref void* ppIndirection)
{ throw new NotImplementedException("getThreadTLSIndex"); }

private Dictionary<CorInfoHelpFunc, ISymbolNode> _helperCache = new Dictionary<CorInfoHelpFunc, ISymbolNode>();
private void* getHelperFtn(CorInfoHelpFunc ftnNum, ref void* ppIndirection)
private readonly Dictionary<CorInfoHelpFunc, (ISymbolNode Symbol, MethodDesc Method)> _helperCache = new();
private void* getHelperFtn(CorInfoHelpFunc ftnNum, ref void* ppIndirection, CORINFO_METHOD_STRUCT_** pMethod)
{
ISymbolNode entryPoint;
if (!_helperCache.TryGetValue(ftnNum, out entryPoint))
if (!_helperCache.TryGetValue(ftnNum, out (ISymbolNode Symbol, MethodDesc Method) entryPointMethodDesc))
{
entryPoint = GetHelperFtnUncached(ftnNum);
_helperCache.Add(ftnNum, entryPoint);
ISymbolNode node = GetHelperFtnUncached(ftnNum, out MethodDesc methodDesc);
entryPointMethodDesc = (node, methodDesc);
_helperCache.Add(ftnNum, entryPointMethodDesc);
}
if (entryPoint.RepresentsIndirectionCell)

if (pMethod != null && entryPointMethodDesc.Method != null)
{
ppIndirection = (void*)ObjectToHandle(entryPoint);
return null;
*pMethod = ObjectToHandle(entryPointMethodDesc.Method);
}
else

if (entryPointMethodDesc.Symbol.RepresentsIndirectionCell)
{
ppIndirection = null;
return (void*)ObjectToHandle(entryPoint);
ppIndirection = (void*)ObjectToHandle(entryPointMethodDesc.Symbol);
return null;
}

ppIndirection = null;
return (void*)ObjectToHandle(entryPointMethodDesc.Symbol);
}

public static ReadyToRunHelperId GetReadyToRunHelperFromStaticBaseHelper(CorInfoHelpFunc helper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1918,12 +1918,12 @@ private static uint _getThreadTLSIndex(IntPtr thisHandle, IntPtr* ppException, v
}

[UnmanagedCallersOnly]
private static void* _getHelperFtn(IntPtr thisHandle, IntPtr* ppException, CorInfoHelpFunc ftnNum, void** ppIndirection)
private static void* _getHelperFtn(IntPtr thisHandle, IntPtr* ppException, CorInfoHelpFunc ftnNum, void** ppIndirection, CORINFO_METHOD_STRUCT_** pMethod)
{
var _this = GetThis(thisHandle);
try
{
return _this.getHelperFtn(ftnNum, ref *ppIndirection);
return _this.getHelperFtn(ftnNum, ref *ppIndirection, pMethod);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -2754,7 +2754,7 @@ private static IntPtr GetUnmanagedCallbacks()
callbacks[126] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_FPSTRUCT_LOWERING*, void>)&_getFpStructLowering;
callbacks[127] = (delegate* unmanaged<IntPtr, IntPtr*, void**, uint>)&_getThreadTLSIndex;
callbacks[128] = (delegate* unmanaged<IntPtr, IntPtr*, void**, int*>)&_getAddrOfCaptureThreadGlobal;
callbacks[129] = (delegate* unmanaged<IntPtr, IntPtr*, CorInfoHelpFunc, void**, void*>)&_getHelperFtn;
callbacks[129] = (delegate* unmanaged<IntPtr, IntPtr*, CorInfoHelpFunc, void**, CORINFO_METHOD_STRUCT_**, void*>)&_getHelperFtn;
callbacks[130] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_CONST_LOOKUP*, CORINFO_ACCESS_FLAGS, void>)&_getFunctionEntryPoint;
callbacks[131] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, byte, CORINFO_CONST_LOOKUP*, void>)&_getFunctionFixedEntryPoint;
callbacks[132] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, void**, void*>)&_getMethodSync;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ FUNCTIONS
void getFpStructLowering(CORINFO_CLASS_HANDLE structHnd, CORINFO_FPSTRUCT_LOWERING* pLowering);
uint32_t getThreadTLSIndex(void **ppIndirection);
int32_t * getAddrOfCaptureThreadGlobal(void **ppIndirection);
void* getHelperFtn (CorInfoHelpFunc ftnNum, void **ppIndirection);
void* getHelperFtn (CorInfoHelpFunc ftnNum, void **ppIndirection, CORINFO_METHOD_HANDLE* pMethod);
void getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP * pResult, CORINFO_ACCESS_FLAGS accessFlags);
void getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, bool isUnsafeFunctionPointer, CORINFO_CONST_LOOKUP * pResult);
void* getMethodSync(CORINFO_METHOD_HANDLE ftn, void **ppIndirection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,9 @@ private void getReadyToRunDelegateCtorHelper(ref CORINFO_RESOLVED_TOKEN pTargetM
pLookup.constLookup = CreateConstLookupToSymbol(_compilation.SymbolNodeFactory.DelegateCtor(delegateTypeDesc, targetMethod));
}

private ISymbolNode GetHelperFtnUncached(CorInfoHelpFunc ftnNum)
private ISymbolNode GetHelperFtnUncached(CorInfoHelpFunc ftnNum, out MethodDesc methodDesc)
{
methodDesc = null;
ReadyToRunHelper id;

switch (ftnNum)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,9 @@ private void getReadyToRunDelegateCtorHelper(ref CORINFO_RESOLVED_TOKEN pTargetM
}
}

private ISymbolNode GetHelperFtnUncached(CorInfoHelpFunc ftnNum)
private ISymbolNode GetHelperFtnUncached(CorInfoHelpFunc ftnNum, out MethodDesc methodDesc)
{
methodDesc = null;
ReadyToRunHelper id;

switch (ftnNum)
Expand Down Expand Up @@ -786,7 +787,6 @@ private ISymbolNode GetHelperFtnUncached(CorInfoHelpFunc ftnNum)
}

string mangledName;
MethodDesc methodDesc;
JitHelper.GetEntryPoint(_compilation.TypeSystemContext, id, out mangledName, out methodDesc);
Debug.Assert(mangledName != null || methodDesc != null);

Expand Down
7 changes: 4 additions & 3 deletions src/coreclr/tools/aot/jitinterface/jitinterface_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ struct JitInterfaceCallbacks
void (* getFpStructLowering)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE structHnd, CORINFO_FPSTRUCT_LOWERING* pLowering);
uint32_t (* getThreadTLSIndex)(void * thisHandle, CorInfoExceptionClass** ppException, void** ppIndirection);
int32_t* (* getAddrOfCaptureThreadGlobal)(void * thisHandle, CorInfoExceptionClass** ppException, void** ppIndirection);
void* (* getHelperFtn)(void * thisHandle, CorInfoExceptionClass** ppException, CorInfoHelpFunc ftnNum, void** ppIndirection);
void* (* getHelperFtn)(void * thisHandle, CorInfoExceptionClass** ppException, CorInfoHelpFunc ftnNum, void** ppIndirection, CORINFO_METHOD_HANDLE* pMethod);
void (* getFunctionEntryPoint)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult, CORINFO_ACCESS_FLAGS accessFlags);
void (* getFunctionFixedEntryPoint)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn, bool isUnsafeFunctionPointer, CORINFO_CONST_LOOKUP* pResult);
void* (* getMethodSync)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn, void** ppIndirection);
Expand Down Expand Up @@ -1451,10 +1451,11 @@ class JitInterfaceWrapper : public ICorJitInfo

virtual void* getHelperFtn(
CorInfoHelpFunc ftnNum,
void** ppIndirection)
void** ppIndirection,
CORINFO_METHOD_HANDLE* pMethod)
{
CorInfoExceptionClass* pException = nullptr;
void* temp = _callbacks->getHelperFtn(_thisHandle, &pException, ftnNum, ppIndirection);
void* temp = _callbacks->getHelperFtn(_thisHandle, &pException, ftnNum, ppIndirection, pMethod);
if (pException != nullptr) throw pException;
return temp;
}
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/tools/superpmi/superpmi-shared/agnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ struct Agnostic_CORINFO_RESOLVED_TOKENout
DWORD cbMethodSpec;
};

struct Agnostic_GetHelperFtn
{
DWORDLONG pMethod;
DWORDLONG ppIndirect;
DWORDLONG result;
};

struct Agnostic_GetArgType_Key
{
// Partial CORINFO_SIG_INFO data
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/tools/superpmi/superpmi-shared/compileresult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,8 @@ void CompileResult::applyRelocs(RelocContext* rc, unsigned char* block1, ULONG b
{
for (unsigned int idx = 0; idx < rc->mc->GetHelperFtn->GetCount(); idx++)
{
DLDL value = rc->mc->GetHelperFtn->GetItem(idx);
if (value.B == tmp.target)
Agnostic_GetHelperFtn value = rc->mc->GetHelperFtn->GetItem(idx);
if (value.result == tmp.target)
{
LogDebug(" REL32 target is result of getHelperFtn(): setting delta=%d (0x%X)",
(int)tmp.target, (int)tmp.target);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ LWM(GetFieldType, DLDL, DLD)
LWM(GetFunctionEntryPoint, DLD, DLD)
LWM(GetFunctionFixedEntryPoint, DWORDLONG, Agnostic_CORINFO_CONST_LOOKUP)
LWM(GetGSCookie, DWORD, DLDL)
LWM(GetHelperFtn, DWORD, DLDL)
LWM(GetHelperFtn, DWORD, Agnostic_GetHelperFtn)
LWM(GetHFAType, DWORDLONG, DWORD)
LWM(GetIntConfigValue, Agnostic_ConfigIntInfo, DWORD)
LWM(GetJitFlags, DWORD, DD)
Expand Down
32 changes: 19 additions & 13 deletions src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2349,32 +2349,38 @@ void MethodContext::repGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* p
*pLookup = SpmiRecordsHelper::RestoreCORINFO_LOOKUP(value);
}

void MethodContext::recGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, void* result)
void MethodContext::recGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, CORINFO_METHOD_HANDLE* pMethod, void* result)
{
if (GetHelperFtn == nullptr)
GetHelperFtn = new LightWeightMap<DWORD, DLDL>();
GetHelperFtn = new LightWeightMap<DWORD, Agnostic_GetHelperFtn>();

DWORD key = (DWORD)ftnNum;

DLDL value;
value.A = CastPointer(*ppIndirection);
value.B = CastPointer(result);
Agnostic_GetHelperFtn value = {}; // Zero value including any struct padding
value.ppIndirect = CastPointer(*ppIndirection);
value.result = CastPointer(result);
value.pMethod = pMethod != nullptr ? CastHandle(*pMethod) : 0;

GetHelperFtn->Add(key, value);
DEBUG_REC(dmpGetHelperFtn(key, value));
}
void MethodContext::dmpGetHelperFtn(DWORD key, DLDL value)
void MethodContext::dmpGetHelperFtn(DWORD key, Agnostic_GetHelperFtn value)
{
printf("GetHelperFtn key ftn-%u, value ppi-%016" PRIX64 " res-%016" PRIX64 "", key, value.A, value.B);
printf("GetHelperFtn key ftn-%u, value ppi-%016" PRIX64 " mth-%016" PRIX64 "res-%016" PRIX64 "", key, value.ppIndirect, value.pMethod, value.result);
}
void* MethodContext::repGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
void* MethodContext::repGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, CORINFO_METHOD_HANDLE* pMethod)
{
DWORD key = (DWORD)ftnNum;
DLDL value = LookupByKeyOrMiss(GetHelperFtn, key, ": key %u", key);
Agnostic_GetHelperFtn value = LookupByKeyOrMiss(GetHelperFtn, key, ": key %u", key);
DEBUG_REP(dmpGetHelperFtn(key, value));

*ppIndirection = (void*)value.A;
return (void*)value.B;
if (pMethod != nullptr)
{
*pMethod = (CORINFO_METHOD_HANDLE)value.pMethod;
}

*ppIndirection = (void*)value.ppIndirect;
return (void*)value.result;
}

//
Expand All @@ -2400,11 +2406,11 @@ bool MethodContext::fndGetHelperFtn(void* functionAddress, CorInfoHelpFunc* pRes
for (unsigned int i = 0; i < GetHelperFtn->GetCount(); i++)
{
DWORD key = GetHelperFtn->GetKey(i);
DLDL val = GetHelperFtn->GetItem(i);
Agnostic_GetHelperFtn val = GetHelperFtn->GetItem(i);

// TODO-Cleanup: this only compares the function addresses, and doesn't account for
// ppIndirection, which will break if the helper is a dynamic helper function.
if (val.B == CastPointer(functionAddress))
if (val.result == CastPointer(functionAddress))
{
*pResult = (CorInfoHelpFunc)key;
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ class MethodContext
CORINFO_METHOD_HANDLE callerHandle,
CORINFO_LOOKUP* pLookup);

void recGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, void* result);
void dmpGetHelperFtn(DWORD key, DLDL value);
void* repGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection);
void recGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, CORINFO_METHOD_HANDLE* pMethod, void* result);
void dmpGetHelperFtn(DWORD key, Agnostic_GetHelperFtn value);
void* repGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, CORINFO_METHOD_HANDLE* pMethod);
bool fndGetHelperFtn(void* functionAddress, CorInfoHelpFunc* pResult);

void recGetJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1456,11 +1456,11 @@ int32_t* interceptor_ICJI::getAddrOfCaptureThreadGlobal(void** ppIndirection)
}

// return the native entry point to an EE helper (see CorInfoHelpFunc)
void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, CORINFO_METHOD_HANDLE* pMethod)
{
mc->cr->AddCall("getHelperFtn");
void* temp = original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection);
mc->recGetHelperFtn(ftnNum, ppIndirection, temp);
void* temp = original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection, pMethod);
mc->recGetHelperFtn(ftnNum, ppIndirection, pMethod, temp);
return temp;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1044,10 +1044,11 @@ int32_t* interceptor_ICJI::getAddrOfCaptureThreadGlobal(

void* interceptor_ICJI::getHelperFtn(
CorInfoHelpFunc ftnNum,
void** ppIndirection)
void** ppIndirection,
CORINFO_METHOD_HANDLE* pMethod)
{
mcs->AddCall("getHelperFtn");
return original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection);
return original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection, pMethod);
}

void interceptor_ICJI::getFunctionEntryPoint(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,9 +915,10 @@ int32_t* interceptor_ICJI::getAddrOfCaptureThreadGlobal(

void* interceptor_ICJI::getHelperFtn(
CorInfoHelpFunc ftnNum,
void** ppIndirection)
void** ppIndirection,
CORINFO_METHOD_HANDLE* pMethod)
{
return original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection);
return original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection, pMethod);
}

void interceptor_ICJI::getFunctionEntryPoint(
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,10 +1271,10 @@ int32_t* MyICJI::getAddrOfCaptureThreadGlobal(void** ppIndirection)
}

// return the native entry point to an EE helper (see CorInfoHelpFunc)
void* MyICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
void* MyICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, CORINFO_METHOD_HANDLE* pMethod)
{
jitInstance->mc->cr->AddCall("getHelperFtn");
return jitInstance->mc->repGetHelperFtn(ftnNum, ppIndirection);
return jitInstance->mc->repGetHelperFtn(ftnNum, ppIndirection, pMethod);
}

// return a callable address of the function (native code). This function
Expand Down
20 changes: 16 additions & 4 deletions src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10689,8 +10689,9 @@ bool CEEInfo::logMsg(unsigned level, const char* fmt, va_list args)

/*********************************************************************/

void* CEEJitInfo::getHelperFtn(CorInfoHelpFunc ftnNum, /* IN */
void ** ppIndirection) /* OUT */
void* CEEJitInfo::getHelperFtn(CorInfoHelpFunc ftnNum, /* IN */
void ** ppIndirection, /* OUT */
CORINFO_METHOD_HANDLE* pMethod) /* OUT */
{
CONTRACTL {
THROWS;
Expand Down Expand Up @@ -10748,6 +10749,11 @@ void* CEEJitInfo::getHelperFtn(CorInfoHelpFunc ftnNum, /* IN */
if (finalTierAddr != NULL)
{
result = finalTierAddr;
if (pMethod != nullptr && HasILBasedDynamicJitHelper((DynamicCorInfoHelpFunc)dynamicFtnNum))
{
(void)LoadDynamicJitHelper((DynamicCorInfoHelpFunc)dynamicFtnNum, (MethodDesc**)pMethod);
_ASSERT(*pMethod != NULL);
}
goto exit;
}

Expand All @@ -10757,6 +10763,11 @@ void* CEEJitInfo::getHelperFtn(CorInfoHelpFunc ftnNum, /* IN */
(void)LoadDynamicJitHelper((DynamicCorInfoHelpFunc)dynamicFtnNum, &helperMD);
_ASSERT(helperMD != NULL);

if (pMethod != NULL)
{
*pMethod = (CORINFO_METHOD_HANDLE)helperMD;
}

// Check if the target MethodDesc is already jitted to its final Tier
// so we no longer need to use indirections and can emit a direct call instead.
//
Expand Down Expand Up @@ -14519,8 +14530,9 @@ PatchpointInfo* CEEInfo::getOSRInfo(unsigned* ilOffset)
UNREACHABLE(); // only called on derived class.
}

void* CEEInfo::getHelperFtn(CorInfoHelpFunc ftnNum, /* IN */
void ** ppIndirection) /* OUT */
void* CEEInfo::getHelperFtn(CorInfoHelpFunc ftnNum, /* IN */
void ** ppIndirection, /* OUT */
CORINFO_METHOD_HANDLE* pMethod) /* OUT */
{
LIMITED_METHOD_CONTRACT;
UNREACHABLE(); // only called on derived class.
Expand Down
Loading
Loading