Skip to content

Update JIT interface to help reduce shared stubs #118462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -3206,12 +3206,6 @@ class ICorDynamicInfo : public ICorStaticInfo
void** ppIndirection = NULL
) = 0;

// returns true if a VM cookie can be generated for it (might be false due to cross-module
// inlining, in which case the inlining should be aborted)
virtual bool canGetCookieForPInvokeCalliSig(
CORINFO_SIG_INFO* szMetaSig
) = 0;

// Generate a cookie based on the signature to pass to INTOP_CALLI in the interpreter.
virtual void* GetCookieForInterpreterCalliSig(
CORINFO_SIG_INFO* szMetaSig) = 0;
Expand Down Expand Up @@ -3297,15 +3291,10 @@ class ICorDynamicInfo : public ICorStaticInfo
// registers a vararg sig & returns a VM cookie for it (which can contain other stuff)
virtual CORINFO_VARARGS_HANDLE getVarArgsHandle(
CORINFO_SIG_INFO *pSig,
CORINFO_METHOD_HANDLE methHnd,
void **ppIndirection = NULL
) = 0;

// returns true if a VM cookie can be generated for it (might be false due to cross-module
// inlining, in which case the inlining should be aborted)
virtual bool canGetVarArgsHandle(
CORINFO_SIG_INFO *pSig
) = 0;

// Allocate a string literal on the heap and return a handle to it
virtual InfoAccessType constructStringLiteral(
CORINFO_MODULE_HANDLE module,
Expand Down
7 changes: 1 addition & 6 deletions src/coreclr/inc/icorjitinfoimpl_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,6 @@ void* GetCookieForPInvokeCalliSig(
void* GetCookieForInterpreterCalliSig(
CORINFO_SIG_INFO* szMetaSig) override;

bool canGetCookieForPInvokeCalliSig(
CORINFO_SIG_INFO* szMetaSig) override;

CORINFO_JUST_MY_CODE_HANDLE getJustMyCodeHandle(
CORINFO_METHOD_HANDLE method,
CORINFO_JUST_MY_CODE_HANDLE** ppIndirection) override;
Expand Down Expand Up @@ -628,11 +625,9 @@ CORINFO_CLASS_HANDLE getStaticFieldCurrentClass(

CORINFO_VARARGS_HANDLE getVarArgsHandle(
CORINFO_SIG_INFO* pSig,
CORINFO_METHOD_HANDLE methHnd,
void** ppIndirection) override;

bool canGetVarArgsHandle(
CORINFO_SIG_INFO* pSig) override;

InfoAccessType constructStringLiteral(
CORINFO_MODULE_HANDLE module,
mdToken metaTok,
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@

#include <minipal/guid.h>

constexpr GUID JITEEVersionIdentifier = { /* fafeaf26-740f-4e0a-b3f4-852fb3d5ccae */
0xfafeaf26,
0x740f,
0x4e0a,
{0xb3, 0xf4, 0x85, 0x2f, 0xb3, 0xd5, 0xcc, 0xae}
constexpr GUID JITEEVersionIdentifier = { /* 7a8cbc56-9e19-4321-80b9-a0d2c578c945 */
0x7a8cbc56,
0x9e19,
0x4321,
{0x80, 0xb9, 0xa0, 0xd2, 0xc5, 0x78, 0xc9, 0x45}
};

#endif // JIT_EE_VERSIONING_GUID_H
2 changes: 0 additions & 2 deletions src/coreclr/jit/ICorJitInfo_names_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,13 @@ DEF_CLR_API(getLocationOfThisType)
DEF_CLR_API(getAddressOfPInvokeTarget)
DEF_CLR_API(GetCookieForPInvokeCalliSig)
DEF_CLR_API(GetCookieForInterpreterCalliSig)
DEF_CLR_API(canGetCookieForPInvokeCalliSig)
DEF_CLR_API(getJustMyCodeHandle)
DEF_CLR_API(GetProfilingHandle)
DEF_CLR_API(getCallInfo)
DEF_CLR_API(getStaticFieldContent)
DEF_CLR_API(getObjectContent)
DEF_CLR_API(getStaticFieldCurrentClass)
DEF_CLR_API(getVarArgsHandle)
DEF_CLR_API(canGetVarArgsHandle)
DEF_CLR_API(constructStringLiteral)
DEF_CLR_API(emptyStringLiteral)
DEF_CLR_API(getFieldThreadLocalStoreID)
Expand Down
21 changes: 2 additions & 19 deletions src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,15 +1396,6 @@ void* WrapICorJitInfo::GetCookieForInterpreterCalliSig(
return temp;
}

bool WrapICorJitInfo::canGetCookieForPInvokeCalliSig(
CORINFO_SIG_INFO* szMetaSig)
{
API_ENTER(canGetCookieForPInvokeCalliSig);
bool temp = wrapHnd->canGetCookieForPInvokeCalliSig(szMetaSig);
API_LEAVE(canGetCookieForPInvokeCalliSig);
return temp;
}

CORINFO_JUST_MY_CODE_HANDLE WrapICorJitInfo::getJustMyCodeHandle(
CORINFO_METHOD_HANDLE method,
CORINFO_JUST_MY_CODE_HANDLE** ppIndirection)
Expand Down Expand Up @@ -1474,23 +1465,15 @@ CORINFO_CLASS_HANDLE WrapICorJitInfo::getStaticFieldCurrentClass(

CORINFO_VARARGS_HANDLE WrapICorJitInfo::getVarArgsHandle(
CORINFO_SIG_INFO* pSig,
CORINFO_METHOD_HANDLE methHnd,
void** ppIndirection)
{
API_ENTER(getVarArgsHandle);
CORINFO_VARARGS_HANDLE temp = wrapHnd->getVarArgsHandle(pSig, ppIndirection);
CORINFO_VARARGS_HANDLE temp = wrapHnd->getVarArgsHandle(pSig, methHnd, ppIndirection);
API_LEAVE(getVarArgsHandle);
return temp;
}

bool WrapICorJitInfo::canGetVarArgsHandle(
CORINFO_SIG_INFO* pSig)
{
API_ENTER(canGetVarArgsHandle);
bool temp = wrapHnd->canGetVarArgsHandle(pSig);
API_LEAVE(canGetVarArgsHandle);
return temp;
}

InfoAccessType WrapICorJitInfo::constructStringLiteral(
CORINFO_MODULE_HANDLE module,
mdToken metaTok,
Expand Down
26 changes: 1 addition & 25 deletions src/coreclr/jit/importercalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,24 +652,6 @@ var_types Compiler::impImportCall(OPCODE opcode,
else if ((opcode == CEE_CALLI) && ((sig->callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_DEFAULT) &&
((sig->callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_VARARG))
{
if (!info.compCompHnd->canGetCookieForPInvokeCalliSig(sig))
{
// Normally this only happens with inlining.
// However, a generic method (or type) being NGENd into another module
// can run into this issue as well. There's not an easy fall-back for AOT
// so instead we fallback to JIT.
if (compIsForInlining())
{
compInlineResult->NoteFatal(InlineObservation::CALLSITE_CANT_EMBED_PINVOKE_COOKIE);
}
else
{
IMPL_LIMITATION("Can't get PInvoke cookie (cross module generics)");
}

return TYP_UNDEF;
}

GenTree* cookie = eeGetPInvokeCookie(sig);

// This cookie is required to be either a simple GT_CNS_INT or
Expand Down Expand Up @@ -766,13 +748,7 @@ var_types Compiler::impImportCall(OPCODE opcode,
if ((sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_VARARG)
{
void *varCookie, *pVarCookie;
if (!info.compCompHnd->canGetVarArgsHandle(sig))
{
compInlineResult->NoteFatal(InlineObservation::CALLSITE_CANT_EMBED_VARARGS_COOKIE);
return TYP_UNDEF;
}

varCookie = info.compCompHnd->getVarArgsHandle(sig, &pVarCookie);
varCookie = info.compCompHnd->getVarArgsHandle(sig, methHnd, &pVarCookie);
assert((!varCookie) != (!pVarCookie));
varArgsCookie = gtNewIconEmbHndNode(varCookie, pVarCookie, GTF_ICON_VARG_HDL, sig);
}
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/inline.def
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ INLINE_OBSERVATION(ARG_HAS_NULL_THIS, bool, "this pointer argument is
INLINE_OBSERVATION(ARG_NO_BASH_TO_INT, bool, "argument can't bash to int", FATAL, CALLSITE)
INLINE_OBSERVATION(ARG_NO_BASH_TO_REF, bool, "argument can't bash to ref", FATAL, CALLSITE)
INLINE_OBSERVATION(ARG_TYPES_INCOMPATIBLE, bool, "argument types incompatible", FATAL, CALLSITE)
INLINE_OBSERVATION(CANT_EMBED_PINVOKE_COOKIE, bool, "can't embed pinvoke cookie", FATAL, CALLSITE)
INLINE_OBSERVATION(CANT_EMBED_VARARGS_COOKIE, bool, "can't embed varargs cookie", FATAL, CALLSITE)
INLINE_OBSERVATION(CANT_CLASS_INIT, bool, "can't class init", FATAL, CALLSITE)
INLINE_OBSERVATION(COMPILATION_ERROR, bool, "compilation error", FATAL, CALLSITE)
INLINE_OBSERVATION(COMPILATION_FAILURE, bool, "failed to compile", FATAL, CALLSITE)
Expand Down
4 changes: 1 addition & 3 deletions src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3668,10 +3668,8 @@ private CORINFO_CONST_LOOKUP CreateConstLookupToSymbol(ISymbolNode symbol)
return null;
}

private IntPtr getVarArgsHandle(CORINFO_SIG_INFO* pSig, ref void* ppIndirection)
private IntPtr getVarArgsHandle(CORINFO_SIG_INFO* pSig, CORINFO_METHOD_STRUCT_* methHnd, ref void* ppIndirection)
{ throw new NotImplementedException("getVarArgsHandle"); }
private bool canGetVarArgsHandle(CORINFO_SIG_INFO* pSig)
{ throw new NotImplementedException("canGetVarArgsHandle"); }

private InfoAccessType emptyStringLiteral(ref void* ppValue)
{
Expand Down
Loading
Loading