LWM(GetArgType, Agnostic_GetArgType_Key, Agnostic_GetArgType_Value)
LWM(GetArrayInitializationData, DLD, DWORDLONG)
LWM(GetArrayRank, DWORDLONG, DWORD)
+LWM(GetArrayIntrinsicID, DWORDLONG, DWORD)
LWM(GetBoundaries, DWORDLONG, Agnostic_GetBoundaries)
LWM(GetBoxHelper, DWORDLONG, DWORD)
LWM(GetBuiltinClass, DWORD, DWORDLONG)
LWM(GetHFAType, DWORDLONG, DWORD)
LWM(GetInlinedCallFrameVptr, DWORD, DLDL)
LWM(GetIntConfigValue, Agnostic_ConfigIntInfo, DWORD)
-LWM(GetIntrinsicID, DWORDLONG, DD)
LWM(GetJitFlags, DWORD, DD)
LWM(GetJitTimeLogFilename, DWORD, DWORD)
LWM(GetJustMyCodeHandle, DWORDLONG, DLDL)
LWM(GetLazyStringLiteralHelper, DWORDLONG, DWORD)
LWM(GetLocationOfThisType, DWORDLONG, Agnostic_CORINFO_LOOKUP_KIND)
-LWM(IsJitIntrinsic, DWORDLONG, DWORD)
+LWM(IsIntrinsic, DWORDLONG, DWORD)
LWM(GetMethodAttribs, DWORDLONG, DWORD)
LWM(GetClassModule, DWORDLONG, DWORDLONG)
LWM(GetModuleAssembly, DWORDLONG, DWORDLONG)
return value;
}
-void MethodContext::recIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn, bool result)
+void MethodContext::recIsIntrinsic(CORINFO_METHOD_HANDLE ftn, bool result)
{
- if (IsJitIntrinsic == nullptr)
- IsJitIntrinsic = new LightWeightMap<DWORDLONG, DWORD>();
+ if (IsIntrinsic == nullptr)
+ IsIntrinsic = new LightWeightMap<DWORDLONG, DWORD>();
DWORDLONG key = CastHandle(ftn);
DWORD value = result ? 1 : 0;
- IsJitIntrinsic->Add(key, value);
- DEBUG_REC(dmpIsJitIntrinsic(key, value));
+ IsIntrinsic->Add(key, value);
+ DEBUG_REC(dmpIsIntrinsic(key, value));
}
-void MethodContext::dmpIsJitIntrinsic(DWORDLONG key, DWORD value)
+void MethodContext::dmpIsIntrinsic(DWORDLONG key, DWORD value)
{
- printf("IsJitIntrinsic key ftn-%016llX, value res-%u", key, value);
+ printf("IsIntrinsic key ftn-%016llX, value res-%u", key, value);
}
-bool MethodContext::repIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn)
+bool MethodContext::repIsIntrinsic(CORINFO_METHOD_HANDLE ftn)
{
DWORDLONG key = CastHandle(ftn);
- AssertMapAndKeyExist(IsJitIntrinsic, key, ": key %016llX", key);
- DWORD value = IsJitIntrinsic->Get(key);
- DEBUG_REP(dmpIsJitIntrinsic(key, value));
+ AssertMapAndKeyExist(IsIntrinsic, key, ": key %016llX", key);
+ DWORD value = IsIntrinsic->Get(key);
+ DEBUG_REP(dmpIsIntrinsic(key, value));
return value != 0;
}
LogException(EXCEPTIONCODE_MC, "Didn't find key %016llX.", methodHandle);
}
-void MethodContext::recGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand, CorInfoIntrinsics result)
-{
- if (GetIntrinsicID == nullptr)
- GetIntrinsicID = new LightWeightMap<DWORDLONG, DD>();
-
- DD value;
- value.A = (pMustExpand != nullptr) ? (DWORD)(*pMustExpand ? 1 : 0) : (DWORD)0;
- value.B = (DWORD)result;
-
- DWORDLONG key = CastHandle(method);
- GetIntrinsicID->Add(key, value);
- DEBUG_REC(dmpGetIntrinsicID(key, value));
-}
-void MethodContext::dmpGetIntrinsicID(DWORDLONG key, DD value)
-{
- printf("GetIntrinsicID key mth-%016llX, mustExpand-%u, value intr-%u", key, value.A, value.B);
-}
-CorInfoIntrinsics MethodContext::repGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand)
-{
- DWORDLONG key = CastHandle(method);
- AssertMapAndKeyExist(GetIntrinsicID, key, ": key %016llX", key);
-
- DD value = GetIntrinsicID->Get(key);
- DEBUG_REP(dmpGetIntrinsicID(key, value));
-
- if (pMustExpand != nullptr)
- {
- *pMustExpand = (value.A == 0) ? false : true;
- }
- CorInfoIntrinsics result = (CorInfoIntrinsics)value.B;
- return result;
-}
-
void MethodContext::recIsIntrinsicType(CORINFO_CLASS_HANDLE cls, bool result)
{
if (IsIntrinsicType == nullptr)
return result;
}
+void MethodContext::recGetArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod, CorInfoArrayIntrinsic result)
+{
+ if (GetArrayIntrinsicID == nullptr)
+ GetArrayIntrinsicID = new LightWeightMap<DWORDLONG, DWORD>();
+
+ DWORDLONG key = CastHandle(hMethod);
+ DWORD value = (DWORD)result;
+ GetArrayIntrinsicID->Add(key, value);
+ DEBUG_REC(dmpGetArrayIntrinsicID(key, value));
+}
+void MethodContext::dmpGetArrayIntrinsicID(DWORDLONG key, DWORD value)
+{
+ printf("GetArrayIntrinsicID key %016llX, value %u", key, value);
+}
+CorInfoArrayIntrinsic MethodContext::repGetArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod)
+{
+ DWORDLONG key = CastHandle(hMethod);
+ AssertMapAndKeyExist(GetArrayIntrinsicID, key, ": key %016llX", key);
+ DWORD value = GetArrayIntrinsicID->Get(key);
+ DEBUG_REP(dmpGetArrayIntrinsicID(key, value));
+ CorInfoArrayIntrinsic result = (CorInfoArrayIntrinsic)value;
+ return result;
+}
+
void MethodContext::recIsFieldStatic(CORINFO_FIELD_HANDLE fhld, bool result)
{
if (IsFieldStatic == nullptr)
void dmpGetClassAttribs(DWORDLONG key, DWORD value);
DWORD repGetClassAttribs(CORINFO_CLASS_HANDLE classHandle);
- void recIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn, bool result);
- void dmpIsJitIntrinsic(DWORDLONG key, DWORD value);
- bool repIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn);
+ void recIsIntrinsic(CORINFO_METHOD_HANDLE ftn, bool result);
+ void dmpIsIntrinsic(DWORDLONG key, DWORD value);
+ bool repIsIntrinsic(CORINFO_METHOD_HANDLE ftn);
void recGetMethodAttribs(CORINFO_METHOD_HANDLE methodHandle, DWORD attribs);
void dmpGetMethodAttribs(DWORDLONG key, DWORD value);
DWORD* exceptionCode);
void repGetCallInfoFromMethodHandle(CORINFO_METHOD_HANDLE methodHandle, CORINFO_CALL_INFO* pResult);
- void recGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand, CorInfoIntrinsics result);
- void dmpGetIntrinsicID(DWORDLONG key, DD value);
- CorInfoIntrinsics repGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand);
-
void recAsCorInfoType(CORINFO_CLASS_HANDLE cls, CorInfoType result);
void dmpAsCorInfoType(DWORDLONG key, DWORD value);
CorInfoType repAsCorInfoType(CORINFO_CLASS_HANDLE cls);
void dmpGetArrayRank(DWORDLONG key, DWORD value);
unsigned repGetArrayRank(CORINFO_CLASS_HANDLE cls);
+ void recGetArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod, CorInfoArrayIntrinsic result);
+ void dmpGetArrayIntrinsicID(DWORDLONG key, DWORD value);
+ CorInfoArrayIntrinsic repGetArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod);
+
void recIsFieldStatic(CORINFO_FIELD_HANDLE fhld, bool result);
void dmpIsFieldStatic(DWORDLONG key, DWORD value);
bool repIsFieldStatic(CORINFO_FIELD_HANDLE fhld);
Packet_GetHelperFtn = 63,
Packet_GetHelperName = 64,
Packet_GetInlinedCallFrameVptr = 65,
- Packet_GetIntrinsicID = 66,
+ Packet_GetArrayIntrinsicID = 66,
Packet_GetJitTimeLogFilename = 67,
Packet_GetJustMyCodeHandle = 68,
Packet_GetLocationOfThisType = 69,
Packet_GetClassModule = 189,
Packet_GetModuleAssembly = 190,
Packet_GetAssemblyName = 191,
- Packet_IsJitIntrinsic = 192,
+ Packet_IsIntrinsic = 192,
Packet_UpdateEntryPointForTailCall = 193,
};
AddFlag(CORINFO_FLG_DISABLE_TIER0_FOR_LOOPS);
AddFlag(CORINFO_FLG_DONT_INLINE);
AddFlag(CORINFO_FLG_DONT_INLINE_CALLER);
- AddFlag(CORINFO_FLG_JIT_INTRINSIC);
AddFlag(CORINFO_FLG_VALUECLASS);
AddFlag(CORINFO_FLG_VAROBJSIZE);
AddFlag(CORINFO_FLG_ARRAY);
/**********************************************************************************/
// Quick check whether the method is a jit intrinsic. Returns the same value as getMethodAttribs(ftn) &
-// CORINFO_FLG_JIT_INTRINSIC, except faster.
-bool interceptor_ICJI::isJitIntrinsic(CORINFO_METHOD_HANDLE ftn)
+// CORINFO_FLG_INTRINSIC, except faster.
+bool interceptor_ICJI::isIntrinsic(CORINFO_METHOD_HANDLE ftn)
{
- mc->cr->AddCall("isJitIntrinsic");
- bool temp = original_ICorJitInfo->isJitIntrinsic(ftn);
- mc->recIsJitIntrinsic(ftn, temp);
+ mc->cr->AddCall("isIntrinsic");
+ bool temp = original_ICorJitInfo->isIntrinsic(ftn);
+ mc->recIsIntrinsic(ftn, temp);
return temp;
}
original_ICorJitInfo->expandRawHandleIntrinsic(pResolvedToken, pResult);
}
-// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
-// getIntrinsicID() returns the intrinsic ID.
-CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */
- )
-{
- mc->cr->AddCall("getIntrinsicID");
- CorInfoIntrinsics temp = original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
- mc->recGetIntrinsicID(method, pMustExpand, temp);
- return temp;
-}
-
// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
bool interceptor_ICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
{
return result;
}
+// Get the index of runtime provided array method
+CorInfoArrayIntrinsic interceptor_ICJI::getArrayIntrinsicID(CORINFO_METHOD_HANDLE ftn)
+{
+ mc->cr->AddCall("getArrayIntrinsicID");
+ CorInfoArrayIntrinsic result = original_ICorJitInfo->getArrayIntrinsicID(ftn);
+ mc->recGetArrayIntrinsicID(ftn, result);
+ return result;
+}
+
// Get static field data for an array
void* interceptor_ICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, uint32_t size)
{
#include "spmiutil.h"
-bool interceptor_ICJI::isJitIntrinsic(
+bool interceptor_ICJI::isIntrinsic(
CORINFO_METHOD_HANDLE ftn)
{
- mcs->AddCall("isJitIntrinsic");
- return original_ICorJitInfo->isJitIntrinsic(ftn);
+ mcs->AddCall("isIntrinsic");
+ return original_ICorJitInfo->isIntrinsic(ftn);
}
uint32_t interceptor_ICJI::getMethodAttribs(
original_ICorJitInfo->expandRawHandleIntrinsic(pResolvedToken, pResult);
}
-CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand)
-{
- mcs->AddCall("getIntrinsicID");
- return original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
-}
-
bool interceptor_ICJI::isIntrinsicType(
CORINFO_CLASS_HANDLE classHnd)
{
return original_ICorJitInfo->getArrayRank(cls);
}
+CorInfoArrayIntrinsic interceptor_ICJI::getArrayIntrinsicID(
+ CORINFO_METHOD_HANDLE ftn)
+{
+ mcs->AddCall("getArrayIntrinsicID");
+ return original_ICorJitInfo->getArrayIntrinsicID(ftn);
+}
+
void* interceptor_ICJI::getArrayInitializationData(
CORINFO_FIELD_HANDLE field,
uint32_t size)
#include "spmiutil.h"
-bool interceptor_ICJI::isJitIntrinsic(
+bool interceptor_ICJI::isIntrinsic(
CORINFO_METHOD_HANDLE ftn)
{
- return original_ICorJitInfo->isJitIntrinsic(ftn);
+ return original_ICorJitInfo->isIntrinsic(ftn);
}
uint32_t interceptor_ICJI::getMethodAttribs(
original_ICorJitInfo->expandRawHandleIntrinsic(pResolvedToken, pResult);
}
-CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand)
-{
- return original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
-}
-
bool interceptor_ICJI::isIntrinsicType(
CORINFO_CLASS_HANDLE classHnd)
{
return original_ICorJitInfo->getArrayRank(cls);
}
+CorInfoArrayIntrinsic interceptor_ICJI::getArrayIntrinsicID(
+ CORINFO_METHOD_HANDLE ftn)
+{
+ return original_ICorJitInfo->getArrayIntrinsicID(ftn);
+}
+
void* interceptor_ICJI::getArrayInitializationData(
CORINFO_FIELD_HANDLE field,
uint32_t size)
/**********************************************************************************/
// Quick check whether the method is a jit intrinsic. Returns the same value as getMethodAttribs(ftn) &
-// CORINFO_FLG_JIT_INTRINSIC, except faster.
-bool MyICJI::isJitIntrinsic(CORINFO_METHOD_HANDLE ftn)
+// CORINFO_FLG_INTRINSIC, except faster.
+bool MyICJI::isIntrinsic(CORINFO_METHOD_HANDLE ftn)
{
- jitInstance->mc->cr->AddCall("isJitIntrinsic");
- return jitInstance->mc->repIsJitIntrinsic(ftn);
+ jitInstance->mc->cr->AddCall("isIntrinsic");
+ return jitInstance->mc->repIsIntrinsic(ftn);
}
// return flags (defined above, CORINFO_FLG_PUBLIC ...)
DebugBreakorAV(129);
}
-// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
-// getIntrinsicID() returns the intrinsic ID.
-CorInfoIntrinsics MyICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */
- )
-{
- jitInstance->mc->cr->AddCall("getIntrinsicID");
- return jitInstance->mc->repGetIntrinsicID(method, pMustExpand);
-}
-
// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
bool MyICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
{
return jitInstance->mc->repGetArrayRank(cls);
}
+// Get the index of runtime provided array method
+CorInfoArrayIntrinsic MyICJI::getArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod)
+{
+ jitInstance->mc->cr->AddCall("getArrayIntrinsicID");
+ return jitInstance->mc->repGetArrayIntrinsicID(hMethod);
+}
+
// Get static field data for an array
void* MyICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, uint32_t size)
{
// CORINFO_FLG_UNUSED = 0x08000000,
CORINFO_FLG_DONT_INLINE = 0x10000000, // The method should not be inlined
CORINFO_FLG_DONT_INLINE_CALLER = 0x20000000, // The method should not be inlined, nor should its callers. It cannot be tail called.
- CORINFO_FLG_JIT_INTRINSIC = 0x40000000, // Method is a potential jit intrinsic; verify identity by name check
+// CORINFO_FLG_UNUSED = 0x40000000,
// These are internal flags that can only be on Classes
CORINFO_FLG_VALUECLASS = 0x00010000, // is the class a value class
CORINFO_Exception_Count,
};
-
-// This enumeration is returned by getIntrinsicID. Methods corresponding to
-// these values will have "well-known" specified behavior. Calls to these
-// methods could be replaced with inlined code corresponding to the
-// specified behavior (without having to examine the IL beforehand).
-
-enum CorInfoIntrinsics
+// These are used to detect array methods as NamedIntrinsic in JIT importer,
+// which otherwise don't have a name.
+enum class CorInfoArrayIntrinsic
{
- CORINFO_INTRINSIC_Array_Get, // Get the value of an element in an array
- CORINFO_INTRINSIC_Array_Address, // Get the address of an element in an array
- CORINFO_INTRINSIC_Array_Set, // Set the value of an element in an array
+ GET = 0,
+ SET = 1,
+ ADDRESS = 2,
- CORINFO_INTRINSIC_ByReference_Ctor,
- CORINFO_INTRINSIC_ByReference_Value,
- CORINFO_INTRINSIC_GetRawHandle,
-
- CORINFO_INTRINSIC_Count,
- CORINFO_INTRINSIC_Illegal = -1, // Not a true intrinsic,
+ ILLEGAL
};
// Can a value be accessed directly from JITed code.
//
/**********************************************************************************/
- // Quick check whether the method is a jit intrinsic. Returns the same value as getMethodAttribs(ftn) & CORINFO_FLG_JIT_INTRINSIC, except faster.
- virtual bool isJitIntrinsic(CORINFO_METHOD_HANDLE ftn) = 0;
+ // Quick check whether the method is a jit intrinsic. Returns the same value as getMethodAttribs(ftn) & CORINFO_FLG_INTRINSIC, except faster.
+ virtual bool isIntrinsic(CORINFO_METHOD_HANDLE ftn) = 0;
// return flags (a bitfield of CorInfoFlags values)
virtual uint32_t getMethodAttribs (
CORINFO_CLASS_HANDLE elemType
) = 0;
- // Given resolved token that corresponds to an intrinsic classified as
- // a CORINFO_INTRINSIC_GetRawHandle intrinsic, fetch the handle associated
- // with the token. If this is not possible at compile-time (because the current method's
- // code is shared and the token contains generic parameters) then indicate
- // how the handle should be looked up at runtime.
+ // Given resolved token that corresponds to an intrinsic classified to
+ // get a raw handle (NI_System_Activator_AllocatorOf etc.), fetch the
+ // handle associated with the token. If this is not possible at
+ // compile-time (because the current method's code is shared and the
+ // token contains generic parameters) then indicate how the handle
+ // should be looked up at runtime.
virtual void expandRawHandleIntrinsic(
CORINFO_RESOLVED_TOKEN * pResolvedToken,
CORINFO_GENERICHANDLE_RESULT * pResult) = 0;
- // If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
- // getIntrinsicID() returns the intrinsic ID.
- // *pMustExpand tells whether or not JIT must expand the intrinsic.
- virtual CorInfoIntrinsics getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand = NULL /* OUT */
- ) = 0;
-
// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
// This defaults to false.
virtual bool isIntrinsicType(
CORINFO_CLASS_HANDLE cls
) = 0;
+ // Get the index of runtime provided array method
+ virtual CorInfoArrayIntrinsic getArrayIntrinsicID(
+ CORINFO_METHOD_HANDLE ftn
+ ) = 0;
+
// Get static field data for an array
virtual void * getArrayInitializationData(
CORINFO_FIELD_HANDLE field,
public:
-bool isJitIntrinsic(
+bool isIntrinsic(
CORINFO_METHOD_HANDLE ftn) override;
uint32_t getMethodAttribs(
CORINFO_RESOLVED_TOKEN* pResolvedToken,
CORINFO_GENERICHANDLE_RESULT* pResult) override;
-CorInfoIntrinsics getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand) override;
-
bool isIntrinsicType(
CORINFO_CLASS_HANDLE classHnd) override;
unsigned getArrayRank(
CORINFO_CLASS_HANDLE cls) override;
+CorInfoArrayIntrinsic getArrayIntrinsicID(
+ CORINFO_METHOD_HANDLE ftn) override;
+
void* getArrayInitializationData(
CORINFO_FIELD_HANDLE field,
uint32_t size) override;
#define GUID_DEFINED
#endif // !GUID_DEFINED
-constexpr GUID JITEEVersionIdentifier = { /* 3d9496d4-03f7-4eb0-bf7a-a88794e74537 */
- 0x3d9496d4,
- 0x03f7,
- 0x4eb0,
- {0xbf, 0x7a, 0xa8, 0x87, 0x94, 0xe7, 0x45, 0x37}
+constexpr GUID JITEEVersionIdentifier = { /* 29ff53ef-3c61-4fc4-bdab-82e39a3d7970 */
+ 0x29ff53ef,
+ 0x3c61,
+ 0x4fc4,
+ {0xbd, 0xab, 0x82, 0xe3, 0x9a, 0x3d, 0x79, 0x70}
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// DO NOT EDIT THIS FILE! IT IS AUTOGENERATED
// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator
// and follow the instructions in docs/project/updating-jitinterface.md
-DEF_CLR_API(isJitIntrinsic)
+DEF_CLR_API(isIntrinsic)
DEF_CLR_API(getMethodAttribs)
DEF_CLR_API(setMethodAttribs)
DEF_CLR_API(getMethodSig)
DEF_CLR_API(getDefaultComparerClass)
DEF_CLR_API(getDefaultEqualityComparerClass)
DEF_CLR_API(expandRawHandleIntrinsic)
-DEF_CLR_API(getIntrinsicID)
DEF_CLR_API(isIntrinsicType)
DEF_CLR_API(getUnmanagedCallConv)
DEF_CLR_API(pInvokeMarshalingRequired)
DEF_CLR_API(satisfiesClassConstraints)
DEF_CLR_API(isSDArray)
DEF_CLR_API(getArrayRank)
+DEF_CLR_API(getArrayIntrinsicID)
DEF_CLR_API(getArrayInitializationData)
DEF_CLR_API(canAccessClass)
DEF_CLR_API(getFieldName)
// clang-format off
/**********************************************************************************/
-bool WrapICorJitInfo::isJitIntrinsic(
+bool WrapICorJitInfo::isIntrinsic(
CORINFO_METHOD_HANDLE ftn)
{
- API_ENTER(isJitIntrinsic);
- bool temp = wrapHnd->isJitIntrinsic(ftn);
- API_LEAVE(isJitIntrinsic);
+ API_ENTER(isIntrinsic);
+ bool temp = wrapHnd->isIntrinsic(ftn);
+ API_LEAVE(isIntrinsic);
return temp;
}
API_LEAVE(expandRawHandleIntrinsic);
}
-CorInfoIntrinsics WrapICorJitInfo::getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand)
-{
- API_ENTER(getIntrinsicID);
- CorInfoIntrinsics temp = wrapHnd->getIntrinsicID(method, pMustExpand);
- API_LEAVE(getIntrinsicID);
- return temp;
-}
-
bool WrapICorJitInfo::isIntrinsicType(
CORINFO_CLASS_HANDLE classHnd)
{
return temp;
}
+CorInfoArrayIntrinsic WrapICorJitInfo::getArrayIntrinsicID(
+ CORINFO_METHOD_HANDLE ftn)
+{
+ API_ENTER(getArrayIntrinsicID);
+ CorInfoArrayIntrinsic temp = wrapHnd->getArrayIntrinsicID(ftn);
+ API_LEAVE(getArrayIntrinsicID);
+ return temp;
+}
+
void* WrapICorJitInfo::getArrayInitializationData(
CORINFO_FIELD_HANDLE field,
uint32_t size)
void impResetLeaveBlock(BasicBlock* block, unsigned jmpAddr);
GenTree* impTypeIsAssignable(GenTree* typeTo, GenTree* typeFrom);
-#ifdef DEBUG
- const char* impGetIntrinsicName(CorInfoIntrinsics intrinsicID);
-#endif // DEBUG
-
GenTree* impIntrinsic(GenTree* newobjThis,
CORINFO_CLASS_HANDLE clsHnd,
CORINFO_METHOD_HANDLE method,
bool tailCall,
CORINFO_RESOLVED_TOKEN* pContstrainedResolvedToken,
CORINFO_THIS_TRANSFORM constraintCallThisTransform,
- CorInfoIntrinsics* pIntrinsicID,
NamedIntrinsic* pIntrinsicName,
bool* isSpecialIntrinsic = nullptr);
GenTree* impMathIntrinsic(CORINFO_METHOD_HANDLE method,
CORINFO_SIG_INFO* sig,
int memberRef,
bool readonlyCall,
- CorInfoIntrinsics intrinsicID);
+ NamedIntrinsic intrinsicName);
GenTree* impInitializeArrayIntrinsic(CORINFO_SIG_INFO* sig);
GenTree* impCreateSpanIntrinsic(CORINFO_SIG_INFO* sig);
// Get the flags
bool eeIsValueClass(CORINFO_CLASS_HANDLE clsHnd);
- bool eeIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn);
+ bool eeIsIntrinsic(CORINFO_METHOD_HANDLE ftn);
bool eeIsFieldStatic(CORINFO_FIELD_HANDLE fldHnd);
var_types eeGetFieldType(CORINFO_FIELD_HANDLE fldHnd, CORINFO_CLASS_HANDLE* pStructHnd = nullptr);
}
FORCEINLINE
-bool Compiler::eeIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn)
+bool Compiler::eeIsIntrinsic(CORINFO_METHOD_HANDLE ftn)
{
- return info.compCompHnd->isJitIntrinsic(ftn);
+ return info.compCompHnd->isIntrinsic(ftn);
}
FORCEINLINE
break;
}
- CORINFO_METHOD_HANDLE methodHnd = nullptr;
- bool isJitIntrinsic = false;
- NamedIntrinsic ni = NI_Illegal;
+ CORINFO_METHOD_HANDLE methodHnd = nullptr;
+ bool isIntrinsic = false;
+ NamedIntrinsic ni = NI_Illegal;
if (resolveTokens)
{
impResolveToken(codeAddr, &resolvedToken, CORINFO_TOKENKIND_Method);
- methodHnd = resolvedToken.hMethod;
- isJitIntrinsic = eeIsJitIntrinsic(methodHnd);
+ methodHnd = resolvedToken.hMethod;
+ isIntrinsic = eeIsIntrinsic(methodHnd);
}
- if (isJitIntrinsic)
+ if (isIntrinsic)
{
ni = lookupNamedIntrinsic(methodHnd);
compInlineResult->Note(InlineObservation::CALLEE_LOOKS_LIKE_WRAPPER);
}
- if (!isJitIntrinsic && !handled && FgStack::IsArgument(pushedStack.Top()))
+ if (!isIntrinsic && !handled && FgStack::IsArgument(pushedStack.Top()))
{
// Optimistically assume that "call(arg)" returns something arg-dependent.
// However, we don't know how many args it expects and its return type.
// If we're importing the special EqualityComparer<T>.Default or Comparer<T>.Default
// intrinsics, flag the helper call. Later during inlining, we can
// remove the helper call if the associated field lookup is unused.
- if ((info.compFlags & CORINFO_FLG_JIT_INTRINSIC) != 0)
+ if ((info.compFlags & CORINFO_FLG_INTRINSIC) != 0)
{
NamedIntrinsic ni = lookupNamedIntrinsic(info.compMethodHnd);
if ((ni == NI_System_Collections_Generic_EqualityComparer_get_Default) ||
switch (oper)
{
case GT_INTRINSIC:
- if (op1->AsIntrinsic()->gtIntrinsicId != op2->AsIntrinsic()->gtIntrinsicId)
+ if (op1->AsIntrinsic()->gtIntrinsicName != op2->AsIntrinsic()->gtIntrinsicName)
{
return false;
}
switch (oper)
{
case GT_INTRINSIC:
- hash += tree->AsIntrinsic()->gtIntrinsicId;
+ hash += tree->AsIntrinsic()->gtIntrinsicName;
break;
case GT_LEA:
hash += static_cast<unsigned>(tree->AsAddrMode()->Offset() << 3) + tree->AsAddrMode()->gtScale;
case GT_INTRINSIC:
intrinsic = tree->AsIntrinsic();
- if (intrinsic->gtIntrinsicId == CORINFO_INTRINSIC_Illegal)
+ // named intrinsic
+ assert(intrinsic->gtIntrinsicName != NI_Illegal);
+
+ // GT_INTRINSIC intrinsics Sin, Cos, Sqrt, Abs ... have higher costs.
+ // TODO: tune these costs target specific as some of these are
+ // target intrinsics and would cost less to generate code.
+ switch (intrinsic->gtIntrinsicName)
{
- // named intrinsic
- assert(intrinsic->gtIntrinsicName != NI_Illegal);
+ default:
+ assert(!"missing case for gtIntrinsicName");
+ costEx = 12;
+ costSz = 12;
+ break;
- // GT_INTRINSIC intrinsics Sin, Cos, Sqrt, Abs ... have higher costs.
- // TODO: tune these costs target specific as some of these are
- // target intrinsics and would cost less to generate code.
- switch (intrinsic->gtIntrinsicName)
- {
- default:
- assert(!"missing case for gtIntrinsicName");
- costEx = 12;
- costSz = 12;
- break;
+ case NI_System_Math_Abs:
+ costEx = 5;
+ costSz = 15;
+ break;
- case NI_System_Math_Abs:
- costEx = 5;
- costSz = 15;
- break;
+ case NI_System_Math_Acos:
+ case NI_System_Math_Acosh:
+ case NI_System_Math_Asin:
+ case NI_System_Math_Asinh:
+ case NI_System_Math_Atan:
+ case NI_System_Math_Atanh:
+ case NI_System_Math_Atan2:
+ case NI_System_Math_Cbrt:
+ case NI_System_Math_Ceiling:
+ case NI_System_Math_Cos:
+ case NI_System_Math_Cosh:
+ case NI_System_Math_Exp:
+ case NI_System_Math_Floor:
+ case NI_System_Math_FMod:
+ case NI_System_Math_FusedMultiplyAdd:
+ case NI_System_Math_ILogB:
+ case NI_System_Math_Log:
+ case NI_System_Math_Log2:
+ case NI_System_Math_Log10:
+ case NI_System_Math_Pow:
+ case NI_System_Math_Round:
+ case NI_System_Math_Sin:
+ case NI_System_Math_Sinh:
+ case NI_System_Math_Sqrt:
+ case NI_System_Math_Tan:
+ case NI_System_Math_Tanh:
+ {
+ // Giving intrinsics a large fixed execution cost is because we'd like to CSE
+ // them, even if they are implemented by calls. This is different from modeling
+ // user calls since we never CSE user calls. We don't do this for target intrinsics
+ // however as they typically represent single instruction calls
- case NI_System_Math_Acos:
- case NI_System_Math_Acosh:
- case NI_System_Math_Asin:
- case NI_System_Math_Asinh:
- case NI_System_Math_Atan:
- case NI_System_Math_Atanh:
- case NI_System_Math_Atan2:
- case NI_System_Math_Cbrt:
- case NI_System_Math_Ceiling:
- case NI_System_Math_Cos:
- case NI_System_Math_Cosh:
- case NI_System_Math_Exp:
- case NI_System_Math_Floor:
- case NI_System_Math_FMod:
- case NI_System_Math_FusedMultiplyAdd:
- case NI_System_Math_ILogB:
- case NI_System_Math_Log:
- case NI_System_Math_Log2:
- case NI_System_Math_Log10:
- case NI_System_Math_Pow:
- case NI_System_Math_Round:
- case NI_System_Math_Sin:
- case NI_System_Math_Sinh:
- case NI_System_Math_Sqrt:
- case NI_System_Math_Tan:
- case NI_System_Math_Tanh:
+ if (IsIntrinsicImplementedByUserCall(intrinsic->gtIntrinsicName))
{
- // Giving intrinsics a large fixed execution cost is because we'd like to CSE
- // them, even if they are implemented by calls. This is different from modeling
- // user calls since we never CSE user calls. We don't do this for target intrinsics
- // however as they typically represent single instruction calls
-
- if (IsIntrinsicImplementedByUserCall(intrinsic->gtIntrinsicName))
- {
- costEx = 36;
- costSz = 4;
- }
- else
- {
- costEx = 3;
- costSz = 4;
- }
- break;
- }
-
- case NI_System_Object_GetType:
- // Giving intrinsics a large fixed execution cost is because we'd like to CSE
- // them, even if they are implemented by calls. This is different from modeling
- // user calls since we never CSE user calls.
costEx = 36;
costSz = 4;
- break;
+ }
+ else
+ {
+ costEx = 3;
+ costSz = 4;
+ }
+ break;
}
+
+ case NI_System_Object_GetType:
+ // Giving intrinsics a large fixed execution cost is because we'd like to CSE
+ // them, even if they are implemented by calls. This is different from modeling
+ // user calls since we never CSE user calls.
+ costEx = 36;
+ costSz = 4;
+ break;
}
level++;
break;
case GT_INTRINSIC:
copy = new (this, GT_INTRINSIC)
GenTreeIntrinsic(tree->TypeGet(), tree->AsOp()->gtOp1, tree->AsOp()->gtOp2,
- tree->AsIntrinsic()->gtIntrinsicId, tree->AsIntrinsic()->gtIntrinsicName,
- tree->AsIntrinsic()->gtMethodHandle);
+ tree->AsIntrinsic()->gtIntrinsicName, tree->AsIntrinsic()->gtMethodHandle);
#ifdef FEATURE_READYTORUN
copy->AsIntrinsic()->gtEntryPoint = tree->AsIntrinsic()->gtEntryPoint;
#endif
{
GenTreeIntrinsic* intrinsic = tree->AsIntrinsic();
- assert(intrinsic->gtIntrinsicId == CORINFO_INTRINSIC_Illegal);
switch (intrinsic->gtIntrinsicName)
{
case NI_System_Math_Abs:
struct GenTreeIntrinsic : public GenTreeOp
{
- CorInfoIntrinsics gtIntrinsicId;
NamedIntrinsic gtIntrinsicName;
CORINFO_METHOD_HANDLE gtMethodHandle; // Method handle of the method which is treated as an intrinsic.
CORINFO_CONST_LOOKUP gtEntryPoint;
#endif
- GenTreeIntrinsic(var_types type,
- GenTree* op1,
- CorInfoIntrinsics intrinsicId,
- NamedIntrinsic intrinsicName,
- CORINFO_METHOD_HANDLE methodHandle)
- : GenTreeOp(GT_INTRINSIC, type, op1, nullptr)
- , gtIntrinsicId(intrinsicId)
- , gtIntrinsicName(intrinsicName)
- , gtMethodHandle(methodHandle)
+ GenTreeIntrinsic(var_types type, GenTree* op1, NamedIntrinsic intrinsicName, CORINFO_METHOD_HANDLE methodHandle)
+ : GenTreeOp(GT_INTRINSIC, type, op1, nullptr), gtIntrinsicName(intrinsicName), gtMethodHandle(methodHandle)
{
- assert(intrinsicId != CORINFO_INTRINSIC_Illegal || intrinsicName != NI_Illegal);
+ assert(intrinsicName != NI_Illegal);
}
- GenTreeIntrinsic(var_types type,
- GenTree* op1,
- GenTree* op2,
- CorInfoIntrinsics intrinsicId,
- NamedIntrinsic intrinsicName,
- CORINFO_METHOD_HANDLE methodHandle)
- : GenTreeOp(GT_INTRINSIC, type, op1, op2)
- , gtIntrinsicId(intrinsicId)
- , gtIntrinsicName(intrinsicName)
- , gtMethodHandle(methodHandle)
+ GenTreeIntrinsic(
+ var_types type, GenTree* op1, GenTree* op2, NamedIntrinsic intrinsicName, CORINFO_METHOD_HANDLE methodHandle)
+ : GenTreeOp(GT_INTRINSIC, type, op1, op2), gtIntrinsicName(intrinsicName), gtMethodHandle(methodHandle)
{
- assert(intrinsicId != CORINFO_INTRINSIC_Illegal || intrinsicName != NI_Illegal);
+ assert(intrinsicName != NI_Illegal);
}
#if DEBUGGABLE_GENTREE
true); // copyBlock
}
-#ifdef DEBUG
-
-//------------------------------------------------------------------------
-// impGetIntrinsicName: Get a string representing a CorInfoIntrinsics value,
-// for use in debug output.
-//
-// Arguments:
-// intrinsicID -- intrinsic ID for which to get the name
-//
-// Returns:
-// string representing intrinsic
-//
-const char* Compiler::impGetIntrinsicName(CorInfoIntrinsics intrinsicID)
-{
- static const char* const intrinsicNameMap[CORINFO_INTRINSIC_Count] = {
- "CORINFO_INTRINSIC_Array_Get", "CORINFO_INTRINSIC_Array_Address", "CORINFO_INTRINSIC_Array_Set",
- "CORINFO_INTRINSIC_ByReference_Ctor", "CORINFO_INTRINSIC_ByReference_Value", "CORINFO_INTRINSIC_GetRawHandle",
- };
-
- if ((0 <= intrinsicID) && (intrinsicID < CORINFO_INTRINSIC_Count))
- {
- return intrinsicNameMap[intrinsicID];
- }
- else
- {
- return "ILLEGAL";
- }
-}
-
-#endif // DEBUG
-
GenTree* Compiler::impCreateSpanIntrinsic(CORINFO_SIG_INFO* sig)
{
assert(sig->numArgs == 1);
// pConstrainedResolvedToken -- resolved token for constrained call, or nullptr
// if call is not constrained
// constraintCallThisTransform -- this transform to apply for a constrained call
-// pIntrinsicID [OUT] -- intrinsic ID (see enumeration in corinfo.h)
+// pIntrinsicName [OUT] -- intrinsic name (see enumeration in namedintrinsiclist.h)
// for "traditional" jit intrinsics
// isSpecialIntrinsic [OUT] -- set true if intrinsic expansion is a call
// that is amenable to special downstream optimization opportunities
// IR tree to use in place of the call, or nullptr if the jit should treat
// the intrinsic call like a normal call.
//
-// pIntrinsicID set to non-illegal value if the call is recognized as a
+// pIntrinsicName set to non-illegal value if the call is recognized as a
// traditional jit intrinsic, even if the intrinsic is not expaned.
//
// isSpecial set true if the expansion is subject to special
bool tailCall,
CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
CORINFO_THIS_TRANSFORM constraintCallThisTransform,
- CorInfoIntrinsics* pIntrinsicID,
NamedIntrinsic* pIntrinsicName,
bool* isSpecialIntrinsic)
{
- assert((methodFlags & (CORINFO_FLG_INTRINSIC | CORINFO_FLG_JIT_INTRINSIC)) != 0);
+ assert((methodFlags & CORINFO_FLG_INTRINSIC) != 0);
- bool mustExpand = false;
- bool isSpecial = false;
- CorInfoIntrinsics intrinsicID = CORINFO_INTRINSIC_Illegal;
- NamedIntrinsic ni = NI_Illegal;
+ bool mustExpand = false;
+ bool isSpecial = false;
+ NamedIntrinsic ni = NI_Illegal;
if ((methodFlags & CORINFO_FLG_INTRINSIC) != 0)
{
- intrinsicID = info.compCompHnd->getIntrinsicID(method, &mustExpand);
-
-#ifdef DEBUG
- if (intrinsicID != CORINFO_INTRINSIC_Illegal)
- {
- JITDUMP("Intrinsic %s Recognized\n", impGetIntrinsicName(intrinsicID));
- }
-#endif // DEBUG
- }
-
- if ((methodFlags & CORINFO_FLG_JIT_INTRINSIC) != 0)
- {
// The recursive non-virtual calls to Jit intrinsics are must-expand by convention.
mustExpand = mustExpand || (gtIsRecursiveCall(method) && !(methodFlags & CORINFO_FLG_VIRTUAL));
- if (intrinsicID == CORINFO_INTRINSIC_Illegal)
- {
- ni = lookupNamedIntrinsic(method);
+ ni = lookupNamedIntrinsic(method);
- // We specially support the following on all platforms to allow for dead
- // code optimization and to more generally support recursive intrinsics.
+ // We specially support the following on all platforms to allow for dead
+ // code optimization and to more generally support recursive intrinsics.
- if (ni == NI_IsSupported_True)
- {
- assert(sig->numArgs == 0);
- return gtNewIconNode(true);
- }
+ if (ni == NI_IsSupported_True)
+ {
+ assert(sig->numArgs == 0);
+ return gtNewIconNode(true);
+ }
- if (ni == NI_IsSupported_False)
- {
- assert(sig->numArgs == 0);
- return gtNewIconNode(false);
- }
+ if (ni == NI_IsSupported_False)
+ {
+ assert(sig->numArgs == 0);
+ return gtNewIconNode(false);
+ }
- if (ni == NI_Throw_PlatformNotSupportedException)
- {
- return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, method, sig, mustExpand);
- }
+ if (ni == NI_Throw_PlatformNotSupportedException)
+ {
+ return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, method, sig, mustExpand);
+ }
#ifdef FEATURE_HW_INTRINSICS
- if ((ni > NI_HW_INTRINSIC_START) && (ni < NI_HW_INTRINSIC_END))
- {
- GenTree* hwintrinsic = impHWIntrinsic(ni, clsHnd, method, sig, mustExpand);
-
- if (mustExpand && (hwintrinsic == nullptr))
- {
- return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_NOT_IMPLEMENTED, method, sig, mustExpand);
- }
+ if ((ni > NI_HW_INTRINSIC_START) && (ni < NI_HW_INTRINSIC_END))
+ {
+ GenTree* hwintrinsic = impHWIntrinsic(ni, clsHnd, method, sig, mustExpand);
- return hwintrinsic;
+ if (mustExpand && (hwintrinsic == nullptr))
+ {
+ return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_NOT_IMPLEMENTED, method, sig, mustExpand);
}
- if ((ni > NI_SIMD_AS_HWINTRINSIC_START) && (ni < NI_SIMD_AS_HWINTRINSIC_END))
- {
- // These intrinsics aren't defined recursively and so they will never be mustExpand
- // Instead, they provide software fallbacks that will be executed instead.
+ return hwintrinsic;
+ }
- assert(!mustExpand);
- return impSimdAsHWIntrinsic(ni, clsHnd, method, sig, newobjThis);
- }
-#endif // FEATURE_HW_INTRINSICS
+ if ((ni > NI_SIMD_AS_HWINTRINSIC_START) && (ni < NI_SIMD_AS_HWINTRINSIC_END))
+ {
+ // These intrinsics aren't defined recursively and so they will never be mustExpand
+ // Instead, they provide software fallbacks that will be executed instead.
+
+ assert(!mustExpand);
+ return impSimdAsHWIntrinsic(ni, clsHnd, method, sig, newobjThis);
}
+#endif // FEATURE_HW_INTRINSICS
}
- *pIntrinsicID = intrinsicID;
*pIntrinsicName = ni;
if (ni == NI_System_StubHelpers_GetStubContext)
mustExpand = true;
}
+ if ((ni == NI_System_ByReference_ctor) || (ni == NI_System_ByReference_get_Value) ||
+ (ni == NI_System_Activator_AllocatorOf) || (ni == NI_System_Activator_DefaultConstructorOf) ||
+ (ni == NI_System_Object_MethodTableOf) || (ni == NI_System_EETypePtr_EETypePtrOf))
+ {
+ mustExpand = true;
+ }
+
GenTree* retNode = nullptr;
// Under debug and minopts, only expand what is required.
// the NextCallReturnAddress intrinsic.
if (!mustExpand && (opts.OptimizationDisabled() || info.compHasNextCallRetAddr))
{
- *pIntrinsicID = CORINFO_INTRINSIC_Illegal;
+ *pIntrinsicName = NI_Illegal;
return retNode;
}
/* First do the intrinsics which are always smaller than a call */
- switch (intrinsicID)
- {
- GenTree* op1;
-
- case CORINFO_INTRINSIC_Array_Address:
- case CORINFO_INTRINSIC_Array_Get:
- case CORINFO_INTRINSIC_Array_Set:
- retNode = impArrayAccessIntrinsic(clsHnd, sig, memberRef, readonlyCall, intrinsicID);
- break;
-
- // Implement ByReference Ctor. This wraps the assignment of the ref into a byref-like field
- // in a value type. The canonical example of this is Span<T>. In effect this is just a
- // substitution. The parameter byref will be assigned into the newly allocated object.
- case CORINFO_INTRINSIC_ByReference_Ctor:
- {
- // Remove call to constructor and directly assign the byref passed
- // to the call to the first slot of the ByReference struct.
- op1 = impPopStack().val;
- GenTree* thisptr = newobjThis;
- CORINFO_FIELD_HANDLE fldHnd = info.compCompHnd->getFieldInClass(clsHnd, 0);
- GenTree* field = gtNewFieldRef(TYP_BYREF, fldHnd, thisptr, 0);
- GenTree* assign = gtNewAssignNode(field, op1);
- GenTree* byReferenceStruct = gtCloneExpr(thisptr->gtGetOp1());
- assert(byReferenceStruct != nullptr);
- impPushOnStack(byReferenceStruct, typeInfo(TI_STRUCT, clsHnd));
- retNode = assign;
- break;
- }
- // Implement ptr value getter for ByReference struct.
- case CORINFO_INTRINSIC_ByReference_Value:
- {
- op1 = impPopStack().val;
- CORINFO_FIELD_HANDLE fldHnd = info.compCompHnd->getFieldInClass(clsHnd, 0);
- GenTree* field = gtNewFieldRef(TYP_BYREF, fldHnd, op1, 0);
- retNode = field;
- break;
- }
-
- case CORINFO_INTRINSIC_GetRawHandle:
- {
- noway_assert(IsTargetAbi(CORINFO_CORERT_ABI)); // Only CoreRT supports it.
- CORINFO_RESOLVED_TOKEN resolvedToken;
- resolvedToken.tokenContext = impTokenLookupContextHandle;
- resolvedToken.tokenScope = info.compScopeHnd;
- resolvedToken.token = memberRef;
- resolvedToken.tokenType = CORINFO_TOKENKIND_Method;
-
- CORINFO_GENERICHANDLE_RESULT embedInfo;
- info.compCompHnd->expandRawHandleIntrinsic(&resolvedToken, &embedInfo);
-
- GenTree* rawHandle = impLookupToTree(&resolvedToken, &embedInfo.lookup, gtTokenToIconFlags(memberRef),
- embedInfo.compileTimeHandle);
- if (rawHandle == nullptr)
- {
- return nullptr;
- }
-
- noway_assert(genTypeSize(rawHandle->TypeGet()) == genTypeSize(TYP_I_IMPL));
-
- unsigned rawHandleSlot = lvaGrabTemp(true DEBUGARG("rawHandle"));
- impAssignTempGen(rawHandleSlot, rawHandle, clsHnd, (unsigned)CHECK_SPILL_NONE);
-
- GenTree* lclVar = gtNewLclvNode(rawHandleSlot, TYP_I_IMPL);
- GenTree* lclVarAddr = gtNewOperNode(GT_ADDR, TYP_I_IMPL, lclVar);
- var_types resultType = JITtype2varType(sig->retType);
- retNode = gtNewOperNode(GT_IND, resultType, lclVarAddr);
-
- break;
- }
-
- default:
- /* Unknown intrinsic */
- intrinsicID = CORINFO_INTRINSIC_Illegal;
- break;
- }
-
- // Look for new-style jit intrinsics by name
if (ni != NI_Illegal)
{
assert(retNode == nullptr);
switch (ni)
{
+ case NI_Array_Address:
+ case NI_Array_Get:
+ case NI_Array_Set:
+ retNode = impArrayAccessIntrinsic(clsHnd, sig, memberRef, readonlyCall, ni);
+ break;
+
case NI_System_String_get_Chars:
{
GenTree* op2 = impPopStack().val;
break;
}
+ // Implement ByReference Ctor. This wraps the assignment of the ref into a byref-like field
+ // in a value type. The canonical example of this is Span<T>. In effect this is just a
+ // substitution. The parameter byref will be assigned into the newly allocated object.
+ case NI_System_ByReference_ctor:
+ {
+ // Remove call to constructor and directly assign the byref passed
+ // to the call to the first slot of the ByReference struct.
+ GenTree* op1 = impPopStack().val;
+ GenTree* thisptr = newobjThis;
+ CORINFO_FIELD_HANDLE fldHnd = info.compCompHnd->getFieldInClass(clsHnd, 0);
+ GenTree* field = gtNewFieldRef(TYP_BYREF, fldHnd, thisptr, 0);
+ GenTree* assign = gtNewAssignNode(field, op1);
+ GenTree* byReferenceStruct = gtCloneExpr(thisptr->gtGetOp1());
+ assert(byReferenceStruct != nullptr);
+ impPushOnStack(byReferenceStruct, typeInfo(TI_STRUCT, clsHnd));
+ retNode = assign;
+ break;
+ }
+
+ // Implement ptr value getter for ByReference struct.
+ case NI_System_ByReference_get_Value:
+ {
+ GenTree* op1 = impPopStack().val;
+ CORINFO_FIELD_HANDLE fldHnd = info.compCompHnd->getFieldInClass(clsHnd, 0);
+ GenTree* field = gtNewFieldRef(TYP_BYREF, fldHnd, op1, 0);
+ retNode = field;
+ break;
+ }
+
case NI_System_Runtime_CompilerServices_RuntimeHelpers_CreateSpan:
{
retNode = impCreateSpanIntrinsic(sig);
break;
}
+ case NI_System_Activator_AllocatorOf:
+ case NI_System_Activator_DefaultConstructorOf:
+ case NI_System_Object_MethodTableOf:
+ case NI_System_EETypePtr_EETypePtrOf:
+ {
+ assert(IsTargetAbi(CORINFO_CORERT_ABI)); // Only CoreRT supports it.
+ CORINFO_RESOLVED_TOKEN resolvedToken;
+ resolvedToken.tokenContext = impTokenLookupContextHandle;
+ resolvedToken.tokenScope = info.compScopeHnd;
+ resolvedToken.token = memberRef;
+ resolvedToken.tokenType = CORINFO_TOKENKIND_Method;
+
+ CORINFO_GENERICHANDLE_RESULT embedInfo;
+ info.compCompHnd->expandRawHandleIntrinsic(&resolvedToken, &embedInfo);
+
+ GenTree* rawHandle = impLookupToTree(&resolvedToken, &embedInfo.lookup, gtTokenToIconFlags(memberRef),
+ embedInfo.compileTimeHandle);
+ if (rawHandle == nullptr)
+ {
+ return nullptr;
+ }
+
+ noway_assert(genTypeSize(rawHandle->TypeGet()) == genTypeSize(TYP_I_IMPL));
+
+ unsigned rawHandleSlot = lvaGrabTemp(true DEBUGARG("rawHandle"));
+ impAssignTempGen(rawHandleSlot, rawHandle, clsHnd, (unsigned)CHECK_SPILL_NONE);
+
+ GenTree* lclVar = gtNewLclvNode(rawHandleSlot, TYP_I_IMPL);
+ GenTree* lclVarAddr = gtNewOperNode(GT_ADDR, TYP_I_IMPL, lclVar);
+ var_types resultType = JITtype2varType(sig->retType);
+ retNode = gtNewOperNode(GT_IND, resultType, lclVarAddr);
+
+ break;
+ }
+
case NI_System_Span_get_Item:
case NI_System_ReadOnlySpan_get_Item:
{
{
JITDUMP("Expanding as special intrinsic\n");
impPopStack();
- op1 = new (this, GT_INTRINSIC)
- GenTreeIntrinsic(genActualType(callType), op1, intrinsicID, ni, method);
+ op1 = new (this, GT_INTRINSIC) GenTreeIntrinsic(genActualType(callType), op1, ni, method);
// Set the CALL flag to indicate that the operator is implemented by a call.
// Set also the EXCEPTION flag because the native implementation of
op1 = gtNewCastNode(callType, op1, false, callType);
}
- op1 = new (this, GT_INTRINSIC)
- GenTreeIntrinsic(genActualType(callType), op1, CORINFO_INTRINSIC_Illegal, intrinsicName, method);
+ op1 = new (this, GT_INTRINSIC) GenTreeIntrinsic(genActualType(callType), op1, intrinsicName, method);
break;
case 2:
op2 = gtNewCastNode(callType, op2, false, callType);
}
- op1 = new (this, GT_INTRINSIC) GenTreeIntrinsic(genActualType(callType), op1, op2,
- CORINFO_INTRINSIC_Illegal, intrinsicName, method);
+ op1 =
+ new (this, GT_INTRINSIC) GenTreeIntrinsic(genActualType(callType), op1, op2, intrinsicName, method);
break;
default:
// Id for the named intrinsic, or Illegal if none.
//
// Notes:
-// method should have CORINFO_FLG_JIT_INTRINSIC set in its attributes,
+// method should have CORINFO_FLG_INTRINSIC set in its attributes,
// otherwise it is not a named jit intrinsic.
//
NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
{
JITDUMP("%s", methodName);
}
- JITDUMP(": ");
if ((namespaceName == nullptr) || (className == nullptr) || (methodName == nullptr))
{
- JITDUMP("Not recognized, not enough metadata\n");
+ // Check if we are dealing with an MD array's known runtime method
+ CorInfoArrayIntrinsic arrayFuncIndex = info.compCompHnd->getArrayIntrinsicID(method);
+ switch (arrayFuncIndex)
+ {
+ case CorInfoArrayIntrinsic::GET:
+ JITDUMP("ARRAY_FUNC_GET: Recognized\n");
+ return NI_Array_Get;
+ case CorInfoArrayIntrinsic::SET:
+ JITDUMP("ARRAY_FUNC_SET: Recognized\n");
+ return NI_Array_Set;
+ case CorInfoArrayIntrinsic::ADDRESS:
+ JITDUMP("ARRAY_FUNC_ADDRESS: Recognized\n");
+ return NI_Array_Address;
+ default:
+ break;
+ }
+
+ JITDUMP(": Not recognized, not enough metadata\n");
return NI_Illegal;
}
+ JITDUMP(": ");
+
NamedIntrinsic result = NI_Illegal;
if (strcmp(namespaceName, "System") == 0)
{
result = NI_System_Enum_HasFlag;
}
+ else if (strcmp(className, "Activator") == 0)
+ {
+ if (strcmp(methodName, "AllocatorOf") == 0)
+ {
+ result = NI_System_Activator_AllocatorOf;
+ }
+ else if (strcmp(methodName, "DefaultConstructorOf") == 0)
+ {
+ result = NI_System_Activator_DefaultConstructorOf;
+ }
+ }
+ else if (strcmp(className, "ByReference`1") == 0)
+ {
+ if (strcmp(methodName, ".ctor") == 0)
+ {
+ result = NI_System_ByReference_ctor;
+ }
+ else if (strcmp(methodName, "get_Value") == 0)
+ {
+ result = NI_System_ByReference_get_Value;
+ }
+ }
else if (strcmp(className, "Math") == 0 || strcmp(className, "MathF") == 0)
{
if (strcmp(methodName, "Abs") == 0)
{
result = NI_System_Object_GetType;
}
+ else if (strcmp(methodName, "MethodTableOf") == 0)
+ {
+ result = NI_System_Object_MethodTableOf;
+ }
}
else if (strcmp(className, "RuntimeTypeHandle") == 0)
{
result = NI_System_ReadOnlySpan_get_Item;
}
}
+ else if (strcmp(className, "EETypePtr") == 0)
+ {
+ if (strcmp(methodName, "EETypePtrOf") == 0)
+ {
+ result = NI_System_EETypePtr_EETypePtrOf;
+ }
+ }
}
else if (strcmp(namespaceName, "System.Threading") == 0)
{
/*****************************************************************************/
GenTree* Compiler::impArrayAccessIntrinsic(
- CORINFO_CLASS_HANDLE clsHnd, CORINFO_SIG_INFO* sig, int memberRef, bool readonlyCall, CorInfoIntrinsics intrinsicID)
+ CORINFO_CLASS_HANDLE clsHnd, CORINFO_SIG_INFO* sig, int memberRef, bool readonlyCall, NamedIntrinsic intrinsicName)
{
/* If we are generating SMALL_CODE, we don't want to use intrinsics for
the following, as it generates fatter code.
/* These intrinsics generate fatter (but faster) code and are only
done if we don't need SMALL_CODE */
- unsigned rank = (intrinsicID == CORINFO_INTRINSIC_Array_Set) ? (sig->numArgs - 1) : sig->numArgs;
+ unsigned rank = (intrinsicName == NI_Array_Set) ? (sig->numArgs - 1) : sig->numArgs;
// The rank 1 case is special because it has to handle two array formats
// we will simply not do that case
// For the ref case, we will only be able to inline if the types match
// (verifier checks for this, we don't care for the nonverified case and the
// type is final (so we don't need to do the cast)
- if ((intrinsicID != CORINFO_INTRINSIC_Array_Get) && !readonlyCall && varTypeIsGC(elemType))
+ if ((intrinsicName != NI_Array_Get) && !readonlyCall && varTypeIsGC(elemType))
{
// Get the call site signature
CORINFO_SIG_INFO LocalSig;
CORINFO_CLASS_HANDLE actualElemClsHnd;
- if (intrinsicID == CORINFO_INTRINSIC_Array_Set)
+ if (intrinsicName == NI_Array_Set)
{
// Fetch the last argument, the one that indicates the type we are setting.
CORINFO_ARG_LIST_HANDLE argType = LocalSig.args;
}
else
{
- assert(intrinsicID == CORINFO_INTRINSIC_Array_Address);
+ assert(intrinsicName == NI_Array_Address);
// Fetch the return type
typeInfo retInfo = verMakeTypeInfo(LocalSig.retType, LocalSig.retTypeClass);
GenTree* val = nullptr;
- if (intrinsicID == CORINFO_INTRINSIC_Array_Set)
+ if (intrinsicName == NI_Array_Set)
{
// Assignment of a struct is more work, and there are more gets than sets.
if (elemType == TYP_STRUCT)
new (this, GT_ARR_ELEM) GenTreeArrElem(TYP_BYREF, arr, static_cast<unsigned char>(rank),
static_cast<unsigned char>(arrayElemSize), elemType, &inds[0]);
- if (intrinsicID != CORINFO_INTRINSIC_Array_Address)
+ if (intrinsicName != NI_Array_Address)
{
if (varTypeIsStruct(elemType))
{
}
}
- if (intrinsicID == CORINFO_INTRINSIC_Array_Set)
+ if (intrinsicName == NI_Array_Set)
{
assert(val != nullptr);
return gtNewAssignNode(arrElem, val);
}
else // (opcode != CEE_CALLI)
{
- CorInfoIntrinsics intrinsicID = CORINFO_INTRINSIC_Count;
- NamedIntrinsic ni = NI_Illegal;
+ NamedIntrinsic ni = NI_Illegal;
// Passing CORINFO_CALLINFO_ALLOWINSTPARAM indicates that this JIT is prepared to
// supply the instantiation parameters necessary to make direct calls to underlying
// <NICE> Factor this into getCallInfo </NICE>
bool isSpecialIntrinsic = false;
- if ((mflags & (CORINFO_FLG_INTRINSIC | CORINFO_FLG_JIT_INTRINSIC)) != 0)
+ if ((mflags & (CORINFO_FLG_INTRINSIC | CORINFO_FLG_INTRINSIC)) != 0)
{
const bool isTailCall = canTailCall && (tailCallFlags != 0);
- call = impIntrinsic(newobjThis, clsHnd, methHnd, sig, mflags, pResolvedToken->token, isReadonlyCall,
- isTailCall, pConstrainedResolvedToken, callInfo->thisTransform, &intrinsicID, &ni,
- &isSpecialIntrinsic);
+ call =
+ impIntrinsic(newobjThis, clsHnd, methHnd, sig, mflags, pResolvedToken->token, isReadonlyCall,
+ isTailCall, pConstrainedResolvedToken, callInfo->thisTransform, &ni, &isSpecialIntrinsic);
if (compDonotInline())
{
NI_System_StubHelpers_GetStubContext,
NI_System_StubHelpers_NextCallReturnAddress,
+ NI_Array_Address,
+ NI_Array_Get,
+ NI_Array_Set,
+
+ NI_System_ByReference_ctor,
+ NI_System_ByReference_get_Value,
+ NI_System_Activator_AllocatorOf,
+ NI_System_Activator_DefaultConstructorOf,
+ NI_System_Object_MethodTableOf,
+ NI_System_EETypePtr_EETypePtrOf,
+
NI_System_Runtime_CompilerServices_RuntimeHelpers_CreateSpan,
NI_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray,
}
// Exit early if the method is not a JIT Intrinsic (which requires the [Intrinsic] attribute).
- if ((methodFlags & CORINFO_FLG_JIT_INTRINSIC) == 0)
+ if ((methodFlags & CORINFO_FLG_INTRINSIC) == 0)
{
return nullptr;
}
unsafe partial class CorInfoImpl
{
[UnmanagedCallersOnly]
- static byte _isJitIntrinsic(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* ftn)
+ static byte _isIntrinsic(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* ftn)
{
var _this = GetThis(thisHandle);
try
{
- return _this.isJitIntrinsic(ftn) ? (byte)1 : (byte)0;
+ return _this.isIntrinsic(ftn) ? (byte)1 : (byte)0;
}
catch (Exception ex)
{
}
[UnmanagedCallersOnly]
- static CorInfoIntrinsics _getIntrinsicID(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* method, byte* pMustExpand)
- {
- var _this = GetThis(thisHandle);
- try
- {
- return _this.getIntrinsicID(method, pMustExpand);
- }
- catch (Exception ex)
- {
- *ppException = _this.AllocException(ex);
- return default;
- }
- }
-
- [UnmanagedCallersOnly]
static byte _isIntrinsicType(IntPtr thisHandle, IntPtr* ppException, CORINFO_CLASS_STRUCT_* classHnd)
{
var _this = GetThis(thisHandle);
}
[UnmanagedCallersOnly]
+ static CorInfoArrayIntrinsic _getArrayIntrinsicID(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* ftn)
+ {
+ var _this = GetThis(thisHandle);
+ try
+ {
+ return _this.getArrayIntrinsicID(ftn);
+ }
+ catch (Exception ex)
+ {
+ *ppException = _this.AllocException(ex);
+ return default;
+ }
+ }
+
+ [UnmanagedCallersOnly]
static void* _getArrayInitializationData(IntPtr thisHandle, IntPtr* ppException, CORINFO_FIELD_STRUCT_* field, uint size)
{
var _this = GetThis(thisHandle);
{
void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 173);
- callbacks[0] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, byte>)&_isJitIntrinsic;
+ callbacks[0] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, byte>)&_isIntrinsic;
callbacks[1] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, uint>)&_getMethodAttribs;
callbacks[2] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CorInfoMethodRuntimeFlags, void>)&_setMethodAttribs;
callbacks[3] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_SIG_INFO*, CORINFO_CLASS_STRUCT_*, void>)&_getMethodSig;
callbacks[15] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*>)&_getDefaultComparerClass;
callbacks[16] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*>)&_getDefaultEqualityComparerClass;
callbacks[17] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_GENERICHANDLE_RESULT*, void>)&_expandRawHandleIntrinsic;
- callbacks[18] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, byte*, CorInfoIntrinsics>)&_getIntrinsicID;
- callbacks[19] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_isIntrinsicType;
- callbacks[20] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_SIG_INFO*, bool*, CorInfoCallConvExtension>)&_getUnmanagedCallConv;
- callbacks[21] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_SIG_INFO*, byte>)&_pInvokeMarshalingRequired;
- callbacks[22] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_METHOD_STRUCT_*, byte>)&_satisfiesMethodConstraints;
- callbacks[23] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, CORINFO_METHOD_STRUCT_*, CORINFO_CLASS_STRUCT_*, bool*, byte>)&_isCompatibleDelegate;
- callbacks[24] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, void>)&_methodMustBeLoadedBeforeCodeIsRun;
- callbacks[25] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_METHOD_STRUCT_*>)&_mapMethodDeclToMethodImpl;
- callbacks[26] = (delegate* unmanaged<IntPtr, IntPtr*, IntPtr*, IntPtr**, void>)&_getGSCookie;
- callbacks[27] = (delegate* unmanaged<IntPtr, IntPtr*, PatchpointInfo*, void>)&_setPatchpointInfo;
- callbacks[28] = (delegate* unmanaged<IntPtr, IntPtr*, uint*, PatchpointInfo*>)&_getOSRInfo;
- callbacks[29] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, void>)&_resolveToken;
- callbacks[30] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, byte>)&_tryResolveToken;
- callbacks[31] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, CORINFO_CONTEXT_STRUCT*, CORINFO_SIG_INFO*, void>)&_findSig;
- callbacks[32] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, CORINFO_CONTEXT_STRUCT*, CORINFO_SIG_INFO*, void>)&_findCallSiteSig;
- callbacks[33] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_CLASS_STRUCT_*>)&_getTokenTypeAsHandle;
- callbacks[34] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, byte>)&_isValidToken;
- callbacks[35] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, byte>)&_isValidStringRef;
- callbacks[36] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, int*, char*>)&_getStringLiteral;
- callbacks[37] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoType>)&_asCorInfoType;
- callbacks[38] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte*>)&_getClassName;
- callbacks[39] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte**, byte*>)&_getClassNameFromMetadata;
- callbacks[40] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint, CORINFO_CLASS_STRUCT_*>)&_getTypeInstantiationArgument;
- callbacks[41] = (delegate* unmanaged<IntPtr, IntPtr*, char**, int*, CORINFO_CLASS_STRUCT_*, byte, byte, byte, int>)&_appendClassName;
- callbacks[42] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_isValueClass;
- callbacks[43] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoInlineTypeCheckSource, CorInfoInlineTypeCheck>)&_canInlineTypeCheck;
- callbacks[44] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getClassAttribs;
- callbacks[45] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_MODULE_STRUCT_*>)&_getClassModule;
- callbacks[46] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, CORINFO_ASSEMBLY_STRUCT_*>)&_getModuleAssembly;
- callbacks[47] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_ASSEMBLY_STRUCT_*, byte*>)&_getAssemblyName;
- callbacks[48] = (delegate* unmanaged<IntPtr, IntPtr*, UIntPtr, void*>)&_LongLifetimeMalloc;
- callbacks[49] = (delegate* unmanaged<IntPtr, IntPtr*, void*, void>)&_LongLifetimeFree;
- callbacks[50] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_MODULE_STRUCT_**, void**, UIntPtr>)&_getClassModuleIdForStatics;
- callbacks[51] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getClassSize;
- callbacks[52] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getHeapClassSize;
- callbacks[53] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_canAllocateOnStack;
- callbacks[54] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte, uint>)&_getClassAlignmentRequirement;
- callbacks[55] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte*, uint>)&_getClassGClayout;
- callbacks[56] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getClassNumInstanceFields;
- callbacks[57] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, int, CORINFO_FIELD_STRUCT_*>)&_getFieldInClass;
- callbacks[58] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, byte*, byte, byte>)&_checkMethodModifier;
- callbacks[59] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_METHOD_STRUCT_*, bool*, CorInfoHelpFunc>)&_getNewHelper;
- callbacks[60] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoHelpFunc>)&_getNewArrHelper;
- callbacks[61] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, byte, CorInfoHelpFunc>)&_getCastingHelper;
- callbacks[62] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoHelpFunc>)&_getSharedCCtorHelper;
- callbacks[63] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*>)&_getTypeForBox;
- callbacks[64] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoHelpFunc>)&_getBoxHelper;
- callbacks[65] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoHelpFunc>)&_getUnBoxHelper;
- callbacks[66] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_LOOKUP_KIND*, CorInfoHelpFunc, CORINFO_CONST_LOOKUP*, byte>)&_getReadyToRunHelper;
- callbacks[67] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_CLASS_STRUCT_*, CORINFO_LOOKUP*, void>)&_getReadyToRunDelegateCtorHelper;
- callbacks[68] = (delegate* unmanaged<IntPtr, IntPtr*, CorInfoHelpFunc, byte*>)&_getHelperName;
- callbacks[69] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, CORINFO_METHOD_STRUCT_*, CORINFO_CONTEXT_STRUCT*, CorInfoInitClassResult>)&_initClass;
- callbacks[70] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, void>)&_classMustBeLoadedBeforeCodeIsRun;
- callbacks[71] = (delegate* unmanaged<IntPtr, IntPtr*, CorInfoClassId, CORINFO_CLASS_STRUCT_*>)&_getBuiltinClass;
- callbacks[72] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoType>)&_getTypeForPrimitiveValueClass;
- callbacks[73] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoType>)&_getTypeForPrimitiveNumericClass;
- callbacks[74] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, byte>)&_canCast;
- callbacks[75] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, byte>)&_areTypesEquivalent;
- callbacks[76] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, TypeCompareState>)&_compareTypesForCast;
- callbacks[77] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, TypeCompareState>)&_compareTypesForEquality;
- callbacks[78] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*>)&_mergeClasses;
- callbacks[79] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, byte>)&_isMoreSpecificType;
- callbacks[80] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*>)&_getParentType;
- callbacks[81] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_**, CorInfoType>)&_getChildType;
- callbacks[82] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_satisfiesClassConstraints;
- callbacks[83] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_isSDArray;
- callbacks[84] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getArrayRank;
+ callbacks[18] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_isIntrinsicType;
+ callbacks[19] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_SIG_INFO*, bool*, CorInfoCallConvExtension>)&_getUnmanagedCallConv;
+ callbacks[20] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_SIG_INFO*, byte>)&_pInvokeMarshalingRequired;
+ callbacks[21] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_METHOD_STRUCT_*, byte>)&_satisfiesMethodConstraints;
+ callbacks[22] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, CORINFO_METHOD_STRUCT_*, CORINFO_CLASS_STRUCT_*, bool*, byte>)&_isCompatibleDelegate;
+ callbacks[23] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, void>)&_methodMustBeLoadedBeforeCodeIsRun;
+ callbacks[24] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_METHOD_STRUCT_*>)&_mapMethodDeclToMethodImpl;
+ callbacks[25] = (delegate* unmanaged<IntPtr, IntPtr*, IntPtr*, IntPtr**, void>)&_getGSCookie;
+ callbacks[26] = (delegate* unmanaged<IntPtr, IntPtr*, PatchpointInfo*, void>)&_setPatchpointInfo;
+ callbacks[27] = (delegate* unmanaged<IntPtr, IntPtr*, uint*, PatchpointInfo*>)&_getOSRInfo;
+ callbacks[28] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, void>)&_resolveToken;
+ callbacks[29] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, byte>)&_tryResolveToken;
+ callbacks[30] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, CORINFO_CONTEXT_STRUCT*, CORINFO_SIG_INFO*, void>)&_findSig;
+ callbacks[31] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, CORINFO_CONTEXT_STRUCT*, CORINFO_SIG_INFO*, void>)&_findCallSiteSig;
+ callbacks[32] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_CLASS_STRUCT_*>)&_getTokenTypeAsHandle;
+ callbacks[33] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, byte>)&_isValidToken;
+ callbacks[34] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, byte>)&_isValidStringRef;
+ callbacks[35] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, uint, int*, char*>)&_getStringLiteral;
+ callbacks[36] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoType>)&_asCorInfoType;
+ callbacks[37] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte*>)&_getClassName;
+ callbacks[38] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte**, byte*>)&_getClassNameFromMetadata;
+ callbacks[39] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint, CORINFO_CLASS_STRUCT_*>)&_getTypeInstantiationArgument;
+ callbacks[40] = (delegate* unmanaged<IntPtr, IntPtr*, char**, int*, CORINFO_CLASS_STRUCT_*, byte, byte, byte, int>)&_appendClassName;
+ callbacks[41] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_isValueClass;
+ callbacks[42] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoInlineTypeCheckSource, CorInfoInlineTypeCheck>)&_canInlineTypeCheck;
+ callbacks[43] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getClassAttribs;
+ callbacks[44] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_MODULE_STRUCT_*>)&_getClassModule;
+ callbacks[45] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, CORINFO_ASSEMBLY_STRUCT_*>)&_getModuleAssembly;
+ callbacks[46] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_ASSEMBLY_STRUCT_*, byte*>)&_getAssemblyName;
+ callbacks[47] = (delegate* unmanaged<IntPtr, IntPtr*, UIntPtr, void*>)&_LongLifetimeMalloc;
+ callbacks[48] = (delegate* unmanaged<IntPtr, IntPtr*, void*, void>)&_LongLifetimeFree;
+ callbacks[49] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_MODULE_STRUCT_**, void**, UIntPtr>)&_getClassModuleIdForStatics;
+ callbacks[50] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getClassSize;
+ callbacks[51] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getHeapClassSize;
+ callbacks[52] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_canAllocateOnStack;
+ callbacks[53] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte, uint>)&_getClassAlignmentRequirement;
+ callbacks[54] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte*, uint>)&_getClassGClayout;
+ callbacks[55] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getClassNumInstanceFields;
+ callbacks[56] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, int, CORINFO_FIELD_STRUCT_*>)&_getFieldInClass;
+ callbacks[57] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, byte*, byte, byte>)&_checkMethodModifier;
+ callbacks[58] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_METHOD_STRUCT_*, bool*, CorInfoHelpFunc>)&_getNewHelper;
+ callbacks[59] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoHelpFunc>)&_getNewArrHelper;
+ callbacks[60] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, byte, CorInfoHelpFunc>)&_getCastingHelper;
+ callbacks[61] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoHelpFunc>)&_getSharedCCtorHelper;
+ callbacks[62] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*>)&_getTypeForBox;
+ callbacks[63] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoHelpFunc>)&_getBoxHelper;
+ callbacks[64] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoHelpFunc>)&_getUnBoxHelper;
+ callbacks[65] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_LOOKUP_KIND*, CorInfoHelpFunc, CORINFO_CONST_LOOKUP*, byte>)&_getReadyToRunHelper;
+ callbacks[66] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_CLASS_STRUCT_*, CORINFO_LOOKUP*, void>)&_getReadyToRunDelegateCtorHelper;
+ callbacks[67] = (delegate* unmanaged<IntPtr, IntPtr*, CorInfoHelpFunc, byte*>)&_getHelperName;
+ callbacks[68] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, CORINFO_METHOD_STRUCT_*, CORINFO_CONTEXT_STRUCT*, CorInfoInitClassResult>)&_initClass;
+ callbacks[69] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, void>)&_classMustBeLoadedBeforeCodeIsRun;
+ callbacks[70] = (delegate* unmanaged<IntPtr, IntPtr*, CorInfoClassId, CORINFO_CLASS_STRUCT_*>)&_getBuiltinClass;
+ callbacks[71] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoType>)&_getTypeForPrimitiveValueClass;
+ callbacks[72] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CorInfoType>)&_getTypeForPrimitiveNumericClass;
+ callbacks[73] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, byte>)&_canCast;
+ callbacks[74] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, byte>)&_areTypesEquivalent;
+ callbacks[75] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, TypeCompareState>)&_compareTypesForCast;
+ callbacks[76] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, TypeCompareState>)&_compareTypesForEquality;
+ callbacks[77] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*>)&_mergeClasses;
+ callbacks[78] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*, byte>)&_isMoreSpecificType;
+ callbacks[79] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_*>)&_getParentType;
+ callbacks[80] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, CORINFO_CLASS_STRUCT_**, CorInfoType>)&_getChildType;
+ callbacks[81] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_satisfiesClassConstraints;
+ callbacks[82] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_isSDArray;
+ callbacks[83] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, uint>)&_getArrayRank;
+ callbacks[84] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CorInfoArrayIntrinsic>)&_getArrayIntrinsicID;
callbacks[85] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, uint, void*>)&_getArrayInitializationData;
callbacks[86] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_METHOD_STRUCT_*, CORINFO_HELPER_DESC*, CorInfoIsAccessAllowedResult>)&_canAccessClass;
callbacks[87] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, byte**, byte*>)&_getFieldName;
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Diagnostics;
-
-using Internal.TypeSystem;
-
-namespace Internal.JitInterface
-{
- internal unsafe partial class CorInfoImpl
- {
- private struct IntrinsicKey
- {
- public string MethodName;
- public string TypeNamespace;
- public string TypeName;
-
- public bool Equals(IntrinsicKey other)
- {
- return (MethodName == other.MethodName) &&
- (TypeNamespace == other.TypeNamespace) &&
- (TypeName == other.TypeName);
- }
-
- public override int GetHashCode()
- {
- return MethodName.GetHashCode() +
- ((TypeNamespace != null) ? TypeNamespace.GetHashCode() : 0) +
- ((TypeName != null) ? TypeName.GetHashCode() : 0);
- }
- }
-
- private class IntrinsicEntry
- {
- public IntrinsicKey Key;
- public CorInfoIntrinsics Id;
- }
-
- private class IntrinsicHashtable : LockFreeReaderHashtable<IntrinsicKey, IntrinsicEntry>
- {
- protected override bool CompareKeyToValue(IntrinsicKey key, IntrinsicEntry value)
- {
- return key.Equals(value.Key);
- }
- protected override bool CompareValueToValue(IntrinsicEntry value1, IntrinsicEntry value2)
- {
- return value1.Key.Equals(value2.Key);
- }
- protected override IntrinsicEntry CreateValueFromKey(IntrinsicKey key)
- {
- Debug.Fail("CreateValueFromKey not supported");
- return null;
- }
- protected override int GetKeyHashCode(IntrinsicKey key)
- {
- return key.GetHashCode();
- }
- protected override int GetValueHashCode(IntrinsicEntry value)
- {
- return value.Key.GetHashCode();
- }
-
- public void Add(CorInfoIntrinsics id, string methodName, string typeNamespace, string typeName)
- {
- var entry = new IntrinsicEntry();
- entry.Id = id;
- entry.Key.MethodName = methodName;
- entry.Key.TypeNamespace = typeNamespace;
- entry.Key.TypeName = typeName;
- AddOrGetExisting(entry);
- }
- }
-
- static IntrinsicHashtable InitializeIntrinsicHashtable()
- {
- IntrinsicHashtable table = new IntrinsicHashtable();
-
- table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Array_Get, "Get", null, null);
- table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Array_Address, "Address", null, null);
- table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Array_Set, "Set", null, null);
- table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_ByReference_Ctor, ".ctor", "System", "ByReference`1");
- table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_ByReference_Value, "get_Value", "System", "ByReference`1");
- table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetRawHandle, "EETypePtrOf", "System", "EETypePtr");
- table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetRawHandle, "MethodTableOf", "System", "Object");
- table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetRawHandle, "DefaultConstructorOf", "System", "Activator");
- table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetRawHandle, "AllocatorOf", "System", "Activator");
-
- return table;
- }
-
- static IntrinsicHashtable s_IntrinsicHashtable = InitializeIntrinsicHashtable();
-
- private CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_STRUCT_* ftn, byte* pMustExpand)
- {
- var method = HandleToObject(ftn);
- return getIntrinsicID(method, pMustExpand);
- }
-
- private CorInfoIntrinsics getIntrinsicID(MethodDesc method, byte* pMustExpand)
- {
- if (pMustExpand != null)
- *pMustExpand = 0;
-
- Debug.Assert(method.IsIntrinsic);
-
- IntrinsicKey key = new IntrinsicKey();
- key.MethodName = method.Name;
-
- var metadataType = method.OwningType as MetadataType;
- if (metadataType != null)
- {
- key.TypeNamespace = metadataType.Namespace;
- key.TypeName = metadataType.Name;
- }
-
- IntrinsicEntry entry;
- if (!s_IntrinsicHashtable.TryGetValue(key, out entry))
- return CorInfoIntrinsics.CORINFO_INTRINSIC_Illegal;
-
- // Some intrinsics need further disambiguation
- CorInfoIntrinsics id = entry.Id;
- switch (id)
- {
- case CorInfoIntrinsics.CORINFO_INTRINSIC_Array_Get:
- case CorInfoIntrinsics.CORINFO_INTRINSIC_Array_Address:
- case CorInfoIntrinsics.CORINFO_INTRINSIC_Array_Set:
- if (!method.OwningType.IsArray)
- return CorInfoIntrinsics.CORINFO_INTRINSIC_Illegal;
- break;
-
- case CorInfoIntrinsics.CORINFO_INTRINSIC_ByReference_Ctor:
- case CorInfoIntrinsics.CORINFO_INTRINSIC_ByReference_Value:
- if (pMustExpand != null)
- *pMustExpand = 1;
- break;
-
- case CorInfoIntrinsics.CORINFO_INTRINSIC_GetRawHandle:
- if (pMustExpand != null)
- *pMustExpand = 1;
- break;
-
- default:
- break;
- }
-
- return id;
- }
- }
-}
return (TypeSystemEntity)HandleToObject((IntPtr)((ulong)contextStruct & ~(ulong)CorInfoContextFlags.CORINFO_CONTEXTFLAGS_MASK));
}
- private bool isJitIntrinsic(CORINFO_METHOD_STRUCT_* ftn)
+ private bool isIntrinsic(CORINFO_METHOD_STRUCT_* ftn)
{
MethodDesc method = HandleToObject(ftn);
- return method.IsIntrinsic;
+ return method.IsIntrinsic || HardwareIntrinsicHelpers.IsHardwareIntrinsic(method);
}
private uint getMethodAttribsInternal(MethodDesc method)
if (method.IsSynchronized)
result |= CorInfoFlag.CORINFO_FLG_SYNCH;
if (method.IsIntrinsic)
- result |= CorInfoFlag.CORINFO_FLG_INTRINSIC | CorInfoFlag.CORINFO_FLG_JIT_INTRINSIC;
+ result |= CorInfoFlag.CORINFO_FLG_INTRINSIC;
if (method.IsVirtual)
result |= CorInfoFlag.CORINFO_FLG_VIRTUAL;
if (method.IsAbstract)
// Check for hardware intrinsics
if (HardwareIntrinsicHelpers.IsHardwareIntrinsic(method))
{
- result |= CorInfoFlag.CORINFO_FLG_JIT_INTRINSIC;
+ result |= CorInfoFlag.CORINFO_FLG_INTRINSIC;
}
return (uint)result;
return rank;
}
+ private CorInfoArrayIntrinsic getArrayIntrinsicID(CORINFO_METHOD_STRUCT_* ftn)
+ {
+ CorInfoArrayIntrinsic kind = CorInfoArrayIntrinsic.ILLEGAL;
+ if (HandleToObject(ftn) is ArrayMethod am)
+ {
+ kind = am.Kind switch
+ {
+ ArrayMethodKind.Get => CorInfoArrayIntrinsic.GET,
+ ArrayMethodKind.Set => CorInfoArrayIntrinsic.SET,
+ ArrayMethodKind.Address => CorInfoArrayIntrinsic.ADDRESS,
+ _ => CorInfoArrayIntrinsic.ILLEGAL
+ };
+ }
+ return kind;
+ }
+
private void* getArrayInitializationData(CORINFO_FIELD_STRUCT_* field, uint size)
{
var fd = HandleToObject(field);
CORINFO_GENERICS_CTXT_KEEP_ALIVE = 0x00000100, // Keep the generics context alive throughout the method even if there is no explicit use, and report its location to the CLR
}
- public enum CorInfoIntrinsics
+ // These are used to detect array methods as NamedIntrinsic in JIT importer,
+ // which otherwise don't have a name.
+ public enum CorInfoArrayIntrinsic
{
- CORINFO_INTRINSIC_Array_Get, // Get the value of an element in an array
- CORINFO_INTRINSIC_Array_Address, // Get the address of an element in an array
- CORINFO_INTRINSIC_Array_Set, // Set the value of an element in an array
- CORINFO_INTRINSIC_ByReference_Ctor,
- CORINFO_INTRINSIC_ByReference_Value,
- CORINFO_INTRINSIC_GetRawHandle,
+ GET = 0,
+ SET = 1,
+ ADDRESS = 2,
- CORINFO_INTRINSIC_Count,
- CORINFO_INTRINSIC_Illegal = -1, // Not a true intrinsic,
+ ILLEGAL
}
// Can a value be accessed directly from JITed code.
// CORINFO_FLG_UNUSED = 0x04000000,
CORINFO_FLG_DONT_INLINE = 0x10000000, // The method should not be inlined
CORINFO_FLG_DONT_INLINE_CALLER = 0x20000000, // The method should not be inlined, nor should its callers. It cannot be tail called.
- CORINFO_FLG_JIT_INTRINSIC = 0x40000000, // Method is a potential jit intrinsic; verify identity by name check
// These are internal flags that can only be on Classes
CORINFO_FLG_VALUECLASS = 0x00010000, // is the class a value class
CorInfoInlineTypeCheck
CorInfoInlineTypeCheckSource
CorInfoInline
-CorInfoIntrinsics
+CorInfoArrayIntrinsic
CorInfoIsAccessAllowedResult
CorInfoMethodRuntimeFlags
CorInfoTailCall
ICorJitInfo::errorTrapFunction,void*
FUNCTIONS
- bool isJitIntrinsic( CORINFO_METHOD_HANDLE ftn );
+ bool isIntrinsic( CORINFO_METHOD_HANDLE ftn );
uint32_t getMethodAttribs( CORINFO_METHOD_HANDLE ftn );
void setMethodAttribs( CORINFO_METHOD_HANDLE ftn, CorInfoMethodRuntimeFlags attribs );
void getMethodSig( CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO *sig, CORINFO_CLASS_HANDLE memberParent );
CORINFO_CLASS_HANDLE getDefaultComparerClass(CORINFO_CLASS_HANDLE elemType);
CORINFO_CLASS_HANDLE getDefaultEqualityComparerClass(CORINFO_CLASS_HANDLE elemType);
void expandRawHandleIntrinsic(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_GENERICHANDLE_RESULT * pResult);
- CorInfoIntrinsics getIntrinsicID( CORINFO_METHOD_HANDLE method , BoolStar pMustExpand);
bool isIntrinsicType( CORINFO_CLASS_HANDLE classHnd );
CorInfoCallConvExtension getUnmanagedCallConv( CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig, bool* pSuppressGCTransition);
bool pInvokeMarshalingRequired( CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig );
bool satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls)
bool isSDArray(CORINFO_CLASS_HANDLE cls)
unsigned getArrayRank(CORINFO_CLASS_HANDLE cls)
+ CorInfoArrayIntrinsic getArrayIntrinsicID(CORINFO_METHOD_HANDLE ftn)
void* getArrayInitializationData(CORINFO_FIELD_HANDLE field, uint32_t size)
CorInfoIsAccessAllowedResult canAccessClass(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_HELPER_DESC* pAccessHelper)
const char* getFieldName(CORINFO_FIELD_HANDLE ftn, const char** moduleName)
<Compile Include="..\..\Common\JitInterface\JitConfigProvider.cs">
<Link>JitInterface\JitConfigProvider.cs</Link>
</Compile>
- <Compile Include="..\..\Common\JitInterface\CorInfoImpl.Intrinsics.cs">
- <Link>JitInterface\CorInfoImpl.Intrinsics.cs</Link>
- </Compile>
<Compile Include="..\..\Common\JitInterface\MemoryHelper.cs">
<Link>JitInterface\MemoryHelper.cs</Link>
</Compile>
// 3) JIT intrinsics - since they have pre-defined behavior
devirt = targetMethod.OwningType.IsValueType ||
(targetMethod.OwningType.IsDelegate && targetMethod.Name == "Invoke") ||
- (targetMethod.OwningType.IsObject && targetMethod.Name == "GetType") ||
- (targetMethod.IsIntrinsic && getIntrinsicID(targetMethod, null) != CorInfoIntrinsics.CORINFO_INTRINSIC_Illegal);
+ (targetMethod.OwningType.IsObject && targetMethod.Name == "GetType");
callVirtCrossingVersionBubble = true;
}
<GenerateDependencyFile>false</GenerateDependencyFile>
<Configurations>Debug;Release;Checked</Configurations>
</PropertyGroup>
-
+
<ItemGroup>
<ProjectReference Include="..\ILCompiler.MetadataTransform\ILCompiler.MetadataTransform.csproj" />
<ProjectReference Include="..\ILCompiler.DependencyAnalysisFramework\ILCompiler.DependencyAnalysisFramework.csproj" />
<Compile Include="..\..\Common\JitInterface\CorInfoImpl.cs">
<Link>JitInterface\CorInfoImpl.cs</Link>
</Compile>
- <Compile Include="..\..\Common\JitInterface\CorInfoImpl.Intrinsics.cs">
- <Link>JitInterface\CorInfoImpl.Intrinsics.cs</Link>
- </Compile>
<Compile Include="..\..\Common\JitInterface\MemoryHelper.cs">
<Link>JitInterface\MemoryHelper.cs</Link>
</Compile>
<Compile Include="..\ILCompiler.ReadyToRun\IBC\MIbcProfileParser.cs" Link="Pgo\MIbcProfileParser.cs" />
<Compile Include="..\ILCompiler.ReadyToRun\Compiler\ProfileData.cs" Link="Pgo\ProfileData.cs" />
-
+
</ItemGroup>
</Project>
struct JitInterfaceCallbacks
{
- bool (* isJitIntrinsic)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn);
+ bool (* isIntrinsic)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn);
uint32_t (* getMethodAttribs)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn);
void (* setMethodAttribs)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn, CorInfoMethodRuntimeFlags attribs);
void (* getMethodSig)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO* sig, CORINFO_CLASS_HANDLE memberParent);
CORINFO_CLASS_HANDLE (* getDefaultComparerClass)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE elemType);
CORINFO_CLASS_HANDLE (* getDefaultEqualityComparerClass)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE elemType);
void (* expandRawHandleIntrinsic)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_GENERICHANDLE_RESULT* pResult);
- CorInfoIntrinsics (* getIntrinsicID)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE method, bool* pMustExpand);
bool (* isIntrinsicType)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE classHnd);
CorInfoCallConvExtension (* getUnmanagedCallConv)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig, bool* pSuppressGCTransition);
bool (* pInvokeMarshalingRequired)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig);
bool (* satisfiesClassConstraints)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
bool (* isSDArray)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
unsigned (* getArrayRank)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
+ CorInfoArrayIntrinsic (* getArrayIntrinsicID)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn);
void* (* getArrayInitializationData)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_FIELD_HANDLE field, uint32_t size);
CorInfoIsAccessAllowedResult (* canAccessClass)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_HELPER_DESC* pAccessHelper);
const char* (* getFieldName)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_FIELD_HANDLE ftn, const char** moduleName);
}
- virtual bool isJitIntrinsic(
+ virtual bool isIntrinsic(
CORINFO_METHOD_HANDLE ftn)
{
CorInfoExceptionClass* pException = nullptr;
- bool temp = _callbacks->isJitIntrinsic(_thisHandle, &pException, ftn);
+ bool temp = _callbacks->isIntrinsic(_thisHandle, &pException, ftn);
if (pException != nullptr) throw pException;
return temp;
}
if (pException != nullptr) throw pException;
}
- virtual CorInfoIntrinsics getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand)
-{
- CorInfoExceptionClass* pException = nullptr;
- CorInfoIntrinsics temp = _callbacks->getIntrinsicID(_thisHandle, &pException, method, pMustExpand);
- if (pException != nullptr) throw pException;
- return temp;
-}
-
virtual bool isIntrinsicType(
CORINFO_CLASS_HANDLE classHnd)
{
return temp;
}
+ virtual CorInfoArrayIntrinsic getArrayIntrinsicID(
+ CORINFO_METHOD_HANDLE ftn)
+{
+ CorInfoExceptionClass* pException = nullptr;
+ CorInfoArrayIntrinsic temp = _callbacks->getArrayIntrinsicID(_thisHandle, &pException, ftn);
+ if (pException != nullptr) throw pException;
+ return temp;
+}
+
virtual void* getArrayInitializationData(
CORINFO_FIELD_HANDLE field,
uint32_t size)
return (GetArrayFuncIndex() >= ARRAY_FUNC_CTOR) ? (mdPublic | mdRTSpecialName) : mdPublic;
}
-/*****************************************************************************************/
-CorInfoIntrinsics ArrayMethodDesc::GetIntrinsicID()
-{
- LIMITED_METHOD_CONTRACT;
-
- switch (GetArrayFuncIndex())
- {
- case ARRAY_FUNC_GET:
- return CORINFO_INTRINSIC_Array_Get;
- case ARRAY_FUNC_SET:
- return CORINFO_INTRINSIC_Array_Set;
- case ARRAY_FUNC_ADDRESS:
- return CORINFO_INTRINSIC_Array_Address;
- default:
- return CORINFO_INTRINSIC_Illegal;
- }
-}
-
#ifndef DACCESS_COMPILE
/*****************************************************************************************/
//These are the only methods we can jit
&& (pMD->IsStatic() || pMD->GetNumGenericMethodArgs() == 0
|| pMD->HasClassInstantiation())
- && (pMD->MayHaveNativeCode() && !pMD->IsFCallOrIntrinsic()))
+ && (pMD->MayHaveNativeCode() && !pMD->IsFCall()))
{
pMD->PrepareInitialCode();
}
bool IsEndOfArray() { LIMITED_METHOD_CONTRACT; return !!(m_dwFlags & FCFuncFlag_EndOfArray); }
bool HasSignature() { LIMITED_METHOD_CONTRACT; return !!(m_dwFlags & FCFuncFlag_HasSignature); }
bool IsUnreferenced(){ LIMITED_METHOD_CONTRACT; return !!(m_dwFlags & FCFuncFlag_Unreferenced); }
- CorInfoIntrinsics IntrinsicID() { LIMITED_METHOD_CONTRACT; return (CorInfoIntrinsics)((INT8)(m_dwFlags >> 16)); }
int DynamicID() { LIMITED_METHOD_CONTRACT; return (int) ((INT8)(m_dwFlags >> 24)); }
ECFunc* NextInArray()
// Most functionality for generic methods is put here
//
-
-
#include "common.h"
#include "method.hpp"
#include "field.h"
{
pMD->SetSynchronized();
}
- if (pTemplateMD->IsJitIntrinsic())
+ if (pTemplateMD->IsIntrinsic())
{
- pMD->SetIsJitIntrinsic();
+ pMD->SetIsIntrinsic();
}
pMD->SetMemberDef(token);
// Point A in our cycle count.
+ // TODO: enable when NamedIntrinsic is available to interpreter
+
+ /*
// Is the method an intrinsic? If so, and if it's one we've written special-case code for
// handle intrinsically.
- CorInfoIntrinsics intrinsicId;
+ NamedIntrinsic intrinsicName;
{
GCX_PREEMP();
- intrinsicId = m_interpCeeInfo.getIntrinsicID(CORINFO_METHOD_HANDLE(methToCall), nullptr);
+ intrinsicName = getIntrinsicName(CORINFO_METHOD_HANDLE(methToCall), nullptr);
}
#if INTERP_TRACING
- if (intrinsicId != CORINFO_INTRINSIC_Illegal)
+ if (intrinsicName == NI_Illegal)
InterlockedIncrement(&s_totalInterpCallsToIntrinsics);
#endif // INTERP_TRACING
bool didIntrinsic = false;
{
switch (intrinsicId)
{
- case CORINFO_INTRINSIC_ByReference_Ctor:
+ case NI_System_ByReference_ctor:
DoByReferenceCtor();
didIntrinsic = true;
break;
- case CORINFO_INTRINSIC_ByReference_Value:
+ case NI_System_ByReference_get_Value:
DoByReferenceValue();
didIntrinsic = true;
break;
#if INTERP_ILSTUBS
- // TODO: enable when NamedIntrinsic is available to interpreter
- /*
case NI_System_StubHelpers_GetStubContext:
OpStackSet<void*>(m_curStackHt, GetStubContext());
OpStackTypeSet(m_curStackHt, InterpreterType(CORINFO_TYPE_NATIVEINT));
m_curStackHt++; didIntrinsic = true;
break;
- */
#endif // INTERP_ILSTUBS
default:
#if INTERP_TRACING
// Now we can return.
return;
}
+ */
// Handle other simple special cases:
// ===========================================================================
-
#include "common.h"
#include "jitinterface.h"
#include "codeman.h"
}
/*********************************************************************/
+// Get the index of runtime provided array method
+CorInfoArrayIntrinsic CEEInfo::getArrayIntrinsicID(CORINFO_METHOD_HANDLE ftn)
+{
+ CONTRACTL {
+ THROWS;
+ GC_TRIGGERS;
+ MODE_PREEMPTIVE;
+ } CONTRACTL_END;
+
+ CorInfoArrayIntrinsic result = CorInfoArrayIntrinsic::ILLEGAL;
+
+ JIT_TO_EE_TRANSITION();
+
+ MethodDesc* pMD = GetMethod(ftn);
+
+ if (pMD->IsArray())
+ {
+ DWORD index = ((ArrayMethodDesc*)pMD)->GetArrayFuncIndex();
+ switch (index)
+ {
+ case 0: // ARRAY_FUNC_GET
+ result = CorInfoArrayIntrinsic::GET;
+ break;
+ case 1: // ARRAY_FUNC_SET
+ result = CorInfoArrayIntrinsic::SET;
+ break;
+ case 2: // ARRAY_FUNC_ADDRESS
+ result = CorInfoArrayIntrinsic::ADDRESS;
+ break;
+ }
+ }
+
+ EE_TO_JIT_TRANSITION();
+
+ return result;
+}
+
+/*********************************************************************/
// Get static field data for an array
// Note that it's OK to return NULL from this method. This will cause
// the JIT to make a runtime call to InitializeArray instead of doing
}
/*********************************************************************/
-bool CEEInfo::isJitIntrinsic(CORINFO_METHOD_HANDLE ftn)
+bool CEEInfo::isIntrinsic(CORINFO_METHOD_HANDLE ftn)
{
CONTRACTL {
NOTHROW;
_ASSERTE(ftn);
MethodDesc *pMD = (MethodDesc*)ftn;
- ret = pMD->IsJitIntrinsic();
+ ret = pMD->IsIntrinsic();
EE_TO_JIT_TRANSITION_LEAF();
result |= CORINFO_FLG_STATIC;
if (pMD->IsSynchronized())
result |= CORINFO_FLG_SYNCH;
- if (pMD->IsFCallOrIntrinsic())
- result |= CORINFO_FLG_NOGCCHECK | CORINFO_FLG_INTRINSIC;
- if (pMD->IsJitIntrinsic())
- result |= CORINFO_FLG_JIT_INTRINSIC;
+ if (pMD->IsFCall())
+ result |= CORINFO_FLG_NOGCCHECK;
+ if (pMD->IsIntrinsic() || pMD->IsArray())
+ result |= CORINFO_FLG_INTRINSIC;
if (IsMdVirtual(attribs))
result |= CORINFO_FLG_VIRTUAL;
if (IsMdAbstract(attribs))
MethodTable * pMT = ftn->GetMethodTable();
- if (ftn->IsJitIntrinsic())
+ if (ftn->IsIntrinsic())
{
if (CoreLibBinder::IsClass(pMT, CLASS__UNSAFE))
{
}
/*********************************************************************/
-CorInfoIntrinsics CEEInfo::getIntrinsicID(CORINFO_METHOD_HANDLE methodHnd,
- bool * pMustExpand)
-{
- CONTRACTL {
- THROWS;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- } CONTRACTL_END;
-
- CorInfoIntrinsics result = CORINFO_INTRINSIC_Illegal;
-
- JIT_TO_EE_TRANSITION();
-
- if (pMustExpand != NULL)
- {
- *pMustExpand = false;
- }
-
- MethodDesc* method = GetMethod(methodHnd);
-
- if (method->IsArray())
- {
- ArrayMethodDesc * arrMethod = (ArrayMethodDesc *)method;
- result = arrMethod->GetIntrinsicID();
- }
- else
- {
- MethodTable * pMT = method->GetMethodTable();
- if (pMT->GetModule()->IsSystem() && pMT->IsByRefLike())
- {
- if (pMT->HasSameTypeDefAs(g_pByReferenceClass))
- {
- // ByReference<T> has just two methods: constructor and Value property
- if (method->IsCtor())
- {
- result = CORINFO_INTRINSIC_ByReference_Ctor;
- }
- else
- {
- _ASSERTE(strcmp(method->GetName(), "get_Value") == 0);
- result = CORINFO_INTRINSIC_ByReference_Value;
- }
- if (pMustExpand != nullptr)
- {
- *pMustExpand = true;
- }
- }
- }
- }
-
- EE_TO_JIT_TRANSITION();
-
- return result;
-}
-
-/*********************************************************************/
bool CEEInfo::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
{
CONTRACTL {
// file:../../doc/BookOfTheRuntime/ClassLoader/MethodDescDesign.doc
//
-
#include "common.h"
#include "excep.h"
#include "dbginterface.h"
}
//*******************************************************************************
-BOOL MethodDesc::IsFCallOrIntrinsic()
-{
- WRAPPER_NO_CONTRACT;
-
- if (IsFCall() || IsArray())
- return TRUE;
-
- // Intrinsic methods on ByReference<T>, Span<T>, or ReadOnlySpan<T>
- MethodTable * pMT = GetMethodTable();
- if (pMT->IsByRefLike() && pMT->GetModule()->IsSystem())
- return TRUE;
-
- return FALSE;
-}
-
-//*******************************************************************************
BOOL MethodDesc::IsPointingToPrestub()
{
CONTRACTL
|| mcArray == GetClassification();
}
-
inline DWORD IsArray() const
{
LIMITED_METHOD_DAC_CONTRACT;
return mcFCall == GetClassification();
}
- BOOL IsFCallOrIntrinsic();
-
BOOL IsQCall();
//================================================================
enum_flag2_IsUnboxingStub = 0x04,
// unused = 0x08,
- enum_flag2_IsJitIntrinsic = 0x10, // Jit may expand method as an intrinsic
+ enum_flag2_IsIntrinsic = 0x10, // Jit may expand method as an intrinsic
enum_flag2_IsEligibleForTieredCompilation = 0x20,
m_wFlags |= mdcHasNativeCodeSlot;
}
- inline BOOL IsJitIntrinsic()
+ inline BOOL IsIntrinsic()
{
LIMITED_METHOD_DAC_CONTRACT;
- return (m_bFlags2 & enum_flag2_IsJitIntrinsic) != 0;
+ return (m_bFlags2 & enum_flag2_IsIntrinsic) != 0;
}
- inline void SetIsJitIntrinsic()
+ inline void SetIsIntrinsic()
{
LIMITED_METHOD_CONTRACT;
- m_bFlags2 |= enum_flag2_IsJitIntrinsic;
+ m_bFlags2 |= enum_flag2_IsIntrinsic;
}
BOOL RequiresCovariantReturnTypeChecking()
{
LIMITED_METHOD_DAC_CONTRACT;
- // The ru
DWORD dwSlot = GetSlot();
DWORD dwVirtuals = GetMethodTable()->GetNumVirtuals();
_ASSERTE(dwSlot >= dwVirtuals);
LPCUTF8 GetMethodName();
DWORD GetAttrs();
- CorInfoIntrinsics GetIntrinsicID();
};
#ifdef HAS_NDIRECT_IMPORT_PRECODE
return (GetModule() == pMT->GetModule());
}
-//==========================================================================================
-BOOL MethodTable::HasSameTypeDefAs_NoLogging(MethodTable *pMT)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- if (this == pMT)
- return TRUE;
-
- // optimize for the negative case where we expect RID mismatch
- if (GetTypeDefRid_NoLogging() != pMT->GetTypeDefRid_NoLogging())
- return FALSE;
-
- if (GetCanonicalMethodTable() == pMT->GetCanonicalMethodTable())
- return TRUE;
-
- return (GetModule_NoLogging() == pMT->GetModule_NoLogging());
-}
-
#ifndef DACCESS_COMPILE
//==========================================================================================
}
BOOL HasSameTypeDefAs(MethodTable *pMT);
- BOOL HasSameTypeDefAs_NoLogging(MethodTable *pMT);
//-------------------------------------------------------------------
// GENERICS & CODE SHARING
NULL,
NULL)))
{
- pNewMD->SetIsJitIntrinsic();
+ pNewMD->SetIsIntrinsic();
}
}