Skip to content

Commit

Permalink
Add support for R2R ldvirtftn helpers (dotnet/coreclr#8608)
Browse files Browse the repository at this point in the history
The codegen for the non-readytorun path (used on CoreCLR) requires the
runtime to support general purpose virtual method resolution based on a
method handle. CoreRT doesn't have such helpers.

Commit migrated from dotnet/coreclr@deb75b4
  • Loading branch information
MichalStrehovsky authored and jkotas committed Dec 14, 2016
1 parent bf09623 commit 8335914
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/coreclr/src/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4934,14 +4934,26 @@ GenTreePtr Compiler::impImportLdvirtftn(GenTreePtr thisPtr,
}

#ifdef FEATURE_READYTORUN_COMPILER
if (opts.IsReadyToRun() && !pCallInfo->exactContextNeedsRuntimeLookup)
if (opts.IsReadyToRun())
{
GenTreeCall* call = gtNewHelperCallNode(CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR, TYP_I_IMPL, GTF_EXCEPT,
gtNewArgList(thisPtr));
if (!pCallInfo->exactContextNeedsRuntimeLookup)
{
GenTreeCall* call = gtNewHelperCallNode(CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR, TYP_I_IMPL, GTF_EXCEPT,
gtNewArgList(thisPtr));

call->setEntryPoint(pCallInfo->codePointerLookup.constLookup);
call->setEntryPoint(pCallInfo->codePointerLookup.constLookup);

return call;
return call;
}

// We need a runtime lookup. CoreRT has a ReadyToRun helper for that too.
if (IsTargetAbi(CORINFO_CORERT_ABI))
{
GenTreePtr ctxTree = getRuntimeContextTree(pCallInfo->codePointerLookup.lookupKind.runtimeLookupKind);

return impReadyToRunHelperToTree(pResolvedToken, CORINFO_HELP_READYTORUN_GENERIC_HANDLE, TYP_I_IMPL,
gtNewArgList(ctxTree), &pCallInfo->codePointerLookup.lookupKind);
}
}
#endif

Expand Down

0 comments on commit 8335914

Please sign in to comment.