CORINFO_CLASS_HANDLE implementingClass,
CORINFO_CONTEXT_HANDLE ownerType);
+void expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult);
+
// 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.
BOOL* pfIsOpenDelegate /* is the delegate open */
);
-// Determines whether the delegate creation obeys security transparency rules
-BOOL isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd);
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
CorInfoInstantiationVerification isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN */
LONG* getAddrOfCaptureThreadGlobal(void** ppIndirection = NULL);
-SIZE_T* getAddrModuleDomainID(CORINFO_MODULE_HANDLE module);
-
// return the native entry point to an EE helper (see CorInfoHelpFunc)
void* getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection = NULL);
return result;
}
+void interceptor_ICJI::expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult)
+{
+ mc->cr->AddCall("expandRawHandleIntrinsic");
+ 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 */
return temp;
}
-// Determines whether the delegate creation obeys security transparency rules
-BOOL interceptor_ICJI::isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd)
-{
- mc->cr->AddCall("isDelegateCreationAllowed");
- BOOL temp = original_ICorJitInfo->isDelegateCreationAllowed(delegateHnd, calleeHnd);
- mc->recIsDelegateCreationAllowed(delegateHnd, calleeHnd, temp);
- return temp;
-}
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN
return temp;
}
-SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
-{
- mc->cr->AddCall("getAddrModuleDomainID");
- return original_ICorJitInfo->getAddrModuleDomainID(module);
-}
-
// return the native entry point to an EE helper (see CorInfoHelpFunc)
void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
{
return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
}
+void interceptor_ICJI::expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult)
+{
+ mcs->AddCall("expandRawHandleIntrinsic");
+ 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 */
return original_ICorJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate);
}
-// Determines whether the delegate creation obeys security transparency rules
-BOOL interceptor_ICJI::isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd)
-{
- mcs->AddCall("isDelegateCreationAllowed");
- return original_ICorJitInfo->isDelegateCreationAllowed(delegateHnd, calleeHnd);
-}
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN
return original_ICorJitInfo->getAddrOfCaptureThreadGlobal(ppIndirection);
}
-SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
-{
- mcs->AddCall("getAddrModuleDomainID");
- return original_ICorJitInfo->getAddrModuleDomainID(module);
-}
-
// return the native entry point to an EE helper (see CorInfoHelpFunc)
void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
{
return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
}
+void interceptor_ICJI::expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult)
+{
+ return 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 */
return original_ICorJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate);
}
-// Determines whether the delegate creation obeys security transparency rules
-BOOL interceptor_ICJI::isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd)
-{
- return original_ICorJitInfo->isDelegateCreationAllowed(delegateHnd, calleeHnd);
-}
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN
return original_ICorJitInfo->getAddrOfCaptureThreadGlobal(ppIndirection);
}
-SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
-{
- return original_ICorJitInfo->getAddrModuleDomainID(module);
-}
-
// return the native entry point to an EE helper (see CorInfoHelpFunc)
void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
{
return result;
}
+void MyICJI::expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult)
+{
+ jitInstance->mc->cr->AddCall("expandRawHandleIntrinsic");
+ LogError("Hit unimplemented expandRawHandleIntrinsic");
+ 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 */
return jitInstance->mc->repIsCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate);
}
-// Determines whether the delegate creation obeys security transparency rules
-BOOL MyICJI::isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd)
-{
- jitInstance->mc->cr->AddCall("isDelegateCreationAllowed");
- return jitInstance->mc->repIsDelegateCreationAllowed(delegateHnd, calleeHnd);
-}
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
CorInfoInstantiationVerification MyICJI::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN */
return jitInstance->mc->repGetAddrOfCaptureThreadGlobal(ppIndirection);
}
-SIZE_T* MyICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
-{
- jitInstance->mc->cr->AddCall("getAddrModuleDomainID");
- LogError("Hit unimplemented getAddrModuleDomainID");
- DebugBreakorAV(88);
- return 0;
-}
-
// return the native entry point to an EE helper (see CorInfoHelpFunc)
void* MyICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
{
#define SELECTANY extern __declspec(selectany)
#endif
-SELECTANY const GUID JITEEVersionIdentifier = { /* f00b3f49-ddd2-49be-ba43-6e49ffa66959 */
- 0xf00b3f49,
- 0xddd2,
- 0x49be,
- { 0xba, 0x43, 0x6e, 0x49, 0xff, 0xa6, 0x69, 0x59 }
+SELECTANY const GUID JITEEVersionIdentifier = { /* e5708e9e-dd18-4287-8745-5d10ff2697cf */
+ 0xe5708e9e,
+ 0xdd18,
+ 0x4287,
+ { 0x87, 0x45, 0x5d, 0x10, 0xff, 0x26, 0x97, 0xcf }
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
CORINFO_INTRINSIC_ByReference_Value,
CORINFO_INTRINSIC_Span_GetItem,
CORINFO_INTRINSIC_ReadOnlySpan_GetItem,
+ CORINFO_INTRINSIC_GetRawHandle,
CORINFO_INTRINSIC_Count,
CORINFO_INTRINSIC_Illegal = -1, // Not a true intrinsic,
CORINFO_CONTEXT_HANDLE ownerType = NULL /* IN */
) = 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.
+ 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.
BOOL *pfIsOpenDelegate /* is the delegate open */
) = 0;
- // Determines whether the delegate creation obeys security transparency rules
- virtual BOOL isDelegateCreationAllowed (
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd
- ) = 0;
-
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
virtual CorInfoInstantiationVerification isInstantiationOfVerifiedGeneric (
void **ppIndirection = NULL
) = 0;
- virtual SIZE_T* getAddrModuleDomainID(CORINFO_MODULE_HANDLE module) = 0;
-
// return the native entry point to an EE helper (see CorInfoHelpFunc)
virtual void* getHelperFtn (
CorInfoHelpFunc ftnNum,
DEF_CLR_API(pInvokeMarshalingRequired)
DEF_CLR_API(satisfiesMethodConstraints)
DEF_CLR_API(isCompatibleDelegate)
-DEF_CLR_API(isDelegateCreationAllowed)
DEF_CLR_API(isInstantiationOfVerifiedGeneric)
DEF_CLR_API(initConstraintsForVerification)
DEF_CLR_API(canSkipMethodVerification)
DEF_CLR_API(getThreadTLSIndex)
DEF_CLR_API(getInlinedCallFrameVptr)
DEF_CLR_API(getAddrOfCaptureThreadGlobal)
-DEF_CLR_API(getAddrModuleDomainID)
DEF_CLR_API(getHelperFtn)
DEF_CLR_API(getFunctionEntryPoint)
DEF_CLR_API(getFunctionFixedEntryPoint)
DEF_CLR_API(getRelocTypeHint)
DEF_CLR_API(getModuleNativeEntryPointRange)
DEF_CLR_API(getExpectedTargetArchitecture)
+DEF_CLR_API(resolveVirtualMethod)
+DEF_CLR_API(expandRawHandleIntrinsic)
#undef DEF_CLR_API
return temp;
}
-BOOL WrapICorJitInfo::isDelegateCreationAllowed(
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd)
-{
- API_ENTER(isDelegateCreationAllowed);
- BOOL temp = wrapHnd->isDelegateCreationAllowed(delegateHnd, calleeHnd);
- API_LEAVE(isDelegateCreationAllowed);
- return temp;
-}
-
-
CorInfoInstantiationVerification WrapICorJitInfo::isInstantiationOfVerifiedGeneric(
CORINFO_METHOD_HANDLE method /* IN */)
{
return temp;
}
-SIZE_T* WrapICorJitInfo::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
-{
- API_ENTER(getAddrModuleDomainID);
- SIZE_T* result = wrapHnd->getAddrModuleDomainID(module);
- API_LEAVE(getAddrModuleDomainID);
- return result;
-}
-
void* WrapICorJitInfo::getHelperFtn(
CorInfoHelpFunc ftnNum,
void **ppIndirection)
return result;
}
+CORINFO_METHOD_HANDLE WrapICorJitInfo::resolveVirtualMethod(
+ CORINFO_METHOD_HANDLE virtualMethod, /* IN */
+ CORINFO_CLASS_HANDLE implementingClass, /* IN */
+ CORINFO_CONTEXT_HANDLE ownerType = NULL /* IN */
+)
+{
+ API_ENTER(resolveVirtualMethod);
+ CORINFO_METHOD_HANDLE result = wrapHnd->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
+ API_LEAVE(resolveVirtualMethod);
+ return result;
+}
+
+void WrapICorJitInfo::expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult)
+{
+ API_ENTER(expandRawHandleIntrinsic);
+ wrapHnd->expandRawHandleIntrinsic(pResolvedToken, pResult);
+ API_LEAVE(expandRawHandleIntrinsic);
+}
+
/**********************************************************************************/
// clang-format on
/**********************************************************************************/
break;
}
+ case CORINFO_INTRINSIC_GetRawHandle:
+ {
+ noway_assert(IsTargetAbi(CORINFO_CORERT_ABI)); // Only CoreRT supports it.
+ CORINFO_RESOLVED_TOKEN resolvedToken;
+ resolvedToken.tokenContext = MAKE_METHODCONTEXT(info.compMethodHnd);
+ resolvedToken.tokenScope = info.compScopeHnd;
+ resolvedToken.token = memberRef;
+ resolvedToken.tokenType = CORINFO_TOKENKIND_Method;
+
+ CORINFO_GENERICHANDLE_RESULT embedInfo;
+ info.compCompHnd->expandRawHandleIntrinsic(&resolvedToken, &embedInfo);
+
+ GenTreePtr 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);
+
+ GenTreePtr lclVar = gtNewLclvNode(rawHandleSlot, TYP_I_IMPL);
+ GenTreePtr lclVarAddr = gtNewOperNode(GT_ADDR, TYP_I_IMPL, lclVar);
+ var_types resultType = JITtype2varType(sig->retType);
+ retNode = gtNewOperNode(GT_IND, resultType, lclVarAddr);
+
+ break;
+ }
+
default:
/* Unknown intrinsic */
break;
call = impIntrinsic(newobjThis, clsHnd, methHnd, sig, pResolvedToken->token, readonlyCall,
(canTailCall && (tailCall != 0)), &intrinsicID);
+ if (compIsForInlining() && compInlineResult->IsFailure())
+ {
+ return callRetTyp;
+ }
+
if (call != nullptr)
{
assert(!(mflags & CORINFO_FLG_VIRTUAL) || (mflags & CORINFO_FLG_FINAL) ||
return result;
}
+void CEEInfo::expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult)
+{
+ LIMITED_METHOD_CONTRACT;
+ UNREACHABLE(); // only called with CoreRT.
+}
+
/*********************************************************************/
void CEEInfo::getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftnHnd,
CORINFO_CONST_LOOKUP * pResult,
return result;
}
-// Determines whether the delegate creation obeys security transparency rules
-BOOL CEEInfo::isDelegateCreationAllowed (
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd)
-{
- CONTRACTL {
- SO_TOLERANT;
- THROWS;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- } CONTRACTL_END;
-
- return TRUE;
-}
-
/*********************************************************************/
// return the unmanaged target *if method has already been prelinked.*
void* CEEInfo::getPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method,
return result;
}
-
-SIZE_T * CEEInfo::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
-{
- CONTRACTL {
- SO_TOLERANT;
- NOTHROW;
- GC_NOTRIGGER;
- MODE_PREEMPTIVE;
- } CONTRACTL_END;
-
- SIZE_T * result = NULL;
-
- JIT_TO_EE_TRANSITION_LEAF();
-
- Module* pModule = GetModule(module);
-
- result = pModule->GetAddrModuleID();
-
- EE_TO_JIT_TRANSITION_LEAF();
-
- return result;
-}
-
LONG * CEEInfo::getAddrOfCaptureThreadGlobal(void **ppIndirection)
{
CONTRACTL {
CORINFO_CONTEXT_HANDLE ownerType
);
+ void expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult);
+
CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_HANDLE method,
bool * pMustExpand = NULL);
CORINFO_CLASS_HANDLE delegateCls,
BOOL* pfIsOpenDelegate);
- // Determines whether the delegate creation obeys security transparency rules
- BOOL isDelegateCreationAllowed (
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd);
-
// ICorFieldInfo stuff
const char* getFieldName (CORINFO_FIELD_HANDLE field,
const char** scopeName);
DWORD getThreadTLSIndex(void **ppIndirection);
const void * getInlinedCallFrameVptr(void **ppIndirection);
- // Returns the address of the domain neutral module id. This only makes sense for domain neutral (shared)
- // modules
- SIZE_T* getAddrModuleDomainID(CORINFO_MODULE_HANDLE module);
-
LONG * getAddrOfCaptureThreadGlobal(void **ppIndirection);
void* getHelperFtn(CorInfoHelpFunc ftnNum, /* IN */
void ** ppIndirection); /* OUT */
return NULL;
}
-SIZE_T* ZapInfo::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
-{
- return m_pEEJitInfo->getAddrModuleDomainID(module);
-}
-
LONG * ZapInfo::getAddrOfCaptureThreadGlobal(void **ppIndirection)
{
_ASSERTE(ppIndirection != NULL);
return m_pEEJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
}
+void ZapInfo::expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult)
+{
+ m_pEEJitInfo->expandRawHandleIntrinsic(pResolvedToken, pResult);
+}
+
CorInfoIntrinsics ZapInfo::getIntrinsicID(CORINFO_METHOD_HANDLE method,
bool * pMustExpand)
{
return m_pEEJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate);
}
-BOOL ZapInfo::isDelegateCreationAllowed (
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd)
-{
- return m_pEEJitInfo->isDelegateCreationAllowed(delegateHnd, calleeHnd);
-}
-
//
// ICorErrorInfo
//
DWORD getThreadTLSIndex(void **ppIndirection);
const void * getInlinedCallFrameVptr(void **ppIndirection);
LONG * getAddrOfCaptureThreadGlobal(void **ppIndirection);
- SIZE_T* getAddrModuleDomainID(CORINFO_MODULE_HANDLE module);
// get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*).
// Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used.
CORINFO_CONTEXT_HANDLE ownerType
);
+ void expandRawHandleIntrinsic(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_GENERICHANDLE_RESULT * pResult);
+
CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_HANDLE method,
bool * pMustExpand = NULL);
bool isInSIMDModule(CORINFO_CLASS_HANDLE classHnd);
CORINFO_CLASS_HANDLE delegateCls,
BOOL* pfIsOpenDelegate);
- BOOL isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd);
-
void getGSCookie(GSCookie * pCookieVal,
GSCookie** ppCookieVal);
// ICorErrorInfo