Use sigInst.methInstCount != 0 to detect generic methods (#11780)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Tue, 23 May 2017 01:27:19 +0000 (18:27 -0700)
committerGitHub <noreply@github.com>
Tue, 23 May 2017 01:27:19 +0000 (18:27 -0700)
`methInstCount` is the thing that RyuJIT uses to detect generic virtual
methods in another place. `CORINFO_CALLCONV_GENERIC` reporting was added
because nobody knew about `methInstCount`. We already report
`methodInstCount` in CoreRT. We can delete a couple of lines on the
CoreRT side by switching to this scheme.

src/jit/importer.cpp

index 65bd12e..9aaf010 100644 (file)
@@ -5071,7 +5071,7 @@ GenTreePtr Compiler::impImportLdvirtftn(GenTreePtr              thisPtr,
     }
 
     // CoreRT generic virtual method
-    if (((pCallInfo->sig.callConv & CORINFO_CALLCONV_GENERIC) != 0) && IsTargetAbi(CORINFO_CORERT_ABI))
+    if ((pCallInfo->sig.sigInst.methInstCount != 0) && IsTargetAbi(CORINFO_CORERT_ABI))
     {
         GenTreePtr runtimeMethodHandle = nullptr;
         if (pCallInfo->exactContextNeedsRuntimeLookup)
@@ -6888,7 +6888,7 @@ var_types Compiler::impImportCall(OPCODE                  opcode,
                 call->gtCall.gtCallObjp = thisPtrCopy;
                 call->gtFlags |= GTF_EXCEPT | (fptr->gtFlags & GTF_GLOB_EFFECT);
 
-                if (((sig->callConv & CORINFO_CALLCONV_GENERIC) != 0) && IsTargetAbi(CORINFO_CORERT_ABI))
+                if ((sig->sigInst.methInstCount != 0) && IsTargetAbi(CORINFO_CORERT_ABI))
                 {
                     // CoreRT generic virtual method: need to handle potential fat function pointers
                     addFatPointerCandidate(call->AsCall());