Use R2R helper for runtime lookups only when USEHELPER was specified (dotnet/coreclr...
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Sun, 9 Jul 2017 04:31:30 +0000 (00:31 -0400)
committerJan Kotas <jkotas@microsoft.com>
Sun, 9 Jul 2017 04:31:30 +0000 (06:31 +0200)
The CoreRT compiler would like to be able to do indirections-based
lookup even when ReadyToRun codegen is specified.

Commit migrated from https://github.com/dotnet/coreclr/commit/29de0696d2e870a891c7312316620083f953604e

src/coreclr/src/jit/importer.cpp

index fc88e1c..b618478 100644 (file)
@@ -1947,18 +1947,18 @@ GenTreePtr Compiler::impRuntimeLookupToTree(CORINFO_RESOLVED_TOKEN* pResolvedTok
 
     GenTreePtr ctxTree = getRuntimeContextTree(pLookup->lookupKind.runtimeLookupKind);
 
-#ifdef FEATURE_READYTORUN_COMPILER
-    if (opts.IsReadyToRun())
-    {
-        return impReadyToRunHelperToTree(pResolvedToken, CORINFO_HELP_READYTORUN_GENERIC_HANDLE, TYP_I_IMPL,
-                                         gtNewArgList(ctxTree), &pLookup->lookupKind);
-    }
-#endif
-
     CORINFO_RUNTIME_LOOKUP* pRuntimeLookup = &pLookup->runtimeLookup;
     // It's available only via the run-time helper function
     if (pRuntimeLookup->indirections == CORINFO_USEHELPER)
     {
+#ifdef FEATURE_READYTORUN_COMPILER
+        if (opts.IsReadyToRun())
+        {
+            return impReadyToRunHelperToTree(pResolvedToken, CORINFO_HELP_READYTORUN_GENERIC_HANDLE, TYP_I_IMPL,
+                                             gtNewArgList(ctxTree), &pLookup->lookupKind);
+        }
+#endif
+
         GenTreeArgList* helperArgs =
             gtNewArgList(ctxTree, gtNewIconEmbHndNode(pRuntimeLookup->signature, nullptr, GTF_ICON_TOKEN_HDL, 0,
                                                       nullptr, compileTimeHandle));