Move fat call policy out of RyuJIT (#32718)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Sun, 23 Feb 2020 23:30:08 +0000 (00:30 +0100)
committerGitHub <noreply@github.com>
Sun, 23 Feb 2020 23:30:08 +0000 (15:30 -0800)
The EE side would like to be able to decide whether to do fat call or not.

src/coreclr/src/inc/corinfo.h
src/coreclr/src/jit/importer.cpp
src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs
src/coreclr/src/tools/Common/JitInterface/CorInfoTypes.cs

index 73e560e..21640c7 100644 (file)
@@ -1130,6 +1130,7 @@ enum CorInfoSigInfoFlags
     CORINFO_SIGFLAG_IS_LOCAL_SIG           = 0x01,
     CORINFO_SIGFLAG_IL_STUB                = 0x02,
     CORINFO_SIGFLAG_SUPPRESS_GC_TRANSITION = 0x04,
+    CORINFO_SIGFLAG_FAT_CALL               = 0x08,
 };
 
 struct CORINFO_SIG_INST
index f1b1eb7..c7c9d4d 100644 (file)
@@ -7425,16 +7425,9 @@ var_types Compiler::impImportCall(OPCODE                  opcode,
         *call->AsCall()->callSig = calliSig;
 #endif // DEBUG
 
-        if (IsTargetAbi(CORINFO_CORERT_ABI))
+        if ((sig->flags & CORINFO_SIGFLAG_FAT_CALL) != 0)
         {
-            bool managedCall = (((calliSig.callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_STDCALL) &&
-                                ((calliSig.callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_C) &&
-                                ((calliSig.callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_THISCALL) &&
-                                ((calliSig.callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_FASTCALL));
-            if (managedCall)
-            {
-                addFatPointerCandidate(call->AsCall());
-            }
+            addFatPointerCandidate(call->AsCall());
         }
     }
     else // (opcode != CEE_CALLI)
index 545e48a..c2167fd 100644 (file)
@@ -1104,7 +1104,16 @@ namespace Internal.JitInterface
         private void findSig(CORINFO_MODULE_STRUCT_* module, uint sigTOK, CORINFO_CONTEXT_STRUCT* context, CORINFO_SIG_INFO* sig)
         {
             var methodIL = (MethodIL)HandleToObject((IntPtr)module);
-            Get_CORINFO_SIG_INFO((MethodSignature)methodIL.GetObject((int)sigTOK), sig);
+            var methodSig = (MethodSignature)methodIL.GetObject((int)sigTOK);
+            Get_CORINFO_SIG_INFO(methodSig, sig);
+
+#if !READYTORUN
+            // Check whether we need to report this as a fat pointer call
+            if (_compilation.IsFatPointerCandidate(methodIL.OwningMethod, methodSig))
+            {
+                sig->flags |= CorInfoSigInfoFlags.CORINFO_SIGFLAG_FAT_CALL;
+            }
+#endif
         }
 
         private void findCallSiteSig(CORINFO_MODULE_STRUCT_* module, uint methTOK, CORINFO_CONTEXT_STRUCT* context, CORINFO_SIG_INFO* sig)
index 1617872..1b3034c 100644 (file)
@@ -389,6 +389,7 @@ namespace Internal.JitInterface
         CORINFO_SIGFLAG_IS_LOCAL_SIG = 0x01,
         CORINFO_SIGFLAG_IL_STUB = 0x02,
         CORINFO_SIGFLAG_SUPPRESS_GC_TRANSITION = 0x04,
+        CORINFO_SIGFLAG_FAT_CALL = 0x08,
     };
 
     // These are returned from getMethodOptions