Skip to content
Merged
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
10 changes: 9 additions & 1 deletion src/coreclr/interpreter/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2748,14 +2748,22 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
m_compHnd->getCallInfo(&resolvedCallToken, pConstrainedToken, m_methodInfo->ftn, flags, &callInfo);
if (callInfo.methodFlags & CORINFO_FLG_INTRINSIC)
{
NamedIntrinsic ni = GetNamedIntrinsic(m_compHnd, m_methodHnd, callInfo.hMethod);
if ((ni == NI_System_StubHelpers_NextCallReturnAddress) && (m_ip[5] == CEE_POP))
{
// Call to System.StubHelpers.NextCallReturnAddress followed by CEE_POP is a special case that we handle
// as a no-op.
m_ip += 6; // Skip the call and the CEE_POP
return;
}

// If we are being asked explicitly to compile an intrinsic for interpreting, we need to forcibly enable
// intrinsics for the recursive call. Otherwise we will just recurse infinitely and overflow stack.
// This expansion can produce value that is inconsistent with the value seen by JIT/R2R code that can
// cause user code to misbehave. This is by design. One-off method Interpretation is for internal use only.
bool isMustExpand = (callInfo.hMethod == m_methodHnd);
if ((InterpConfig.InterpMode() == 3) || isMustExpand)
{
NamedIntrinsic ni = GetNamedIntrinsic(m_compHnd, m_methodHnd, callInfo.hMethod);
if (EmitNamedIntrinsicCall(ni, resolvedCallToken.hClass, callInfo.hMethod, callInfo.sig))
{
m_ip += 5;
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/interpreter/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ NamedIntrinsic GetNamedIntrinsic(COMP_HANDLE compHnd, CORINFO_METHOD_HANDLE comp
return NI_System_Math_ReciprocalSqrtEstimate;
}
}
else if (!strcmp(namespaceName, "System.StubHelpers"))
{
if (!strcmp(className, "StubHelpers"))
{
if (!strcmp(methodName, "NextCallReturnAddress"))
return NI_System_StubHelpers_NextCallReturnAddress;
}
}
else if (!strcmp(namespaceName, "System.Numerics"))
{
if (!strcmp(className, "Vector") && !strcmp(methodName, "get_IsHardwareAccelerated"))
Expand Down