Skip to content

Commit

Permalink
Delete deprecated tailcalls support (#35552)
Browse files Browse the repository at this point in the history
Follow up on #341
  • Loading branch information
jkotas committed Apr 28, 2020
1 parent e301ec1 commit bd34833
Show file tree
Hide file tree
Showing 39 changed files with 90 additions and 2,326 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,6 @@ CORINFO_METHOD_HANDLE GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,

void MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd);

// return a thunk that will copy the arguments for the given signature.
void* getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags);

bool getTailCallHelpers(
CORINFO_RESOLVED_TOKEN* callToken,
CORINFO_SIG_INFO* sig,
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/ToolBox/superpmi/superpmi-shared/lwmlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ LWM(GetRelocTypeHint, DWORDLONG, DWORD)
LWM(GetSharedCCtorHelper, DWORDLONG, DWORD)
LWM(GetStringConfigValue, DWORD, DWORD)
LWM(GetSystemVAmd64PassStructInRegisterDescriptor, DWORDLONG, Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor)
LWM(GetTailCallCopyArgsThunk, Agnostic_GetTailCallCopyArgsThunk, DWORDLONG)
LWM(GetTailCallHelpers, Agnostic_GetTailCallHelpers, Agnostic_CORINFO_TAILCALL_HELPERS)
LWM(GetThreadTLSIndex, DWORD, DLD)
LWM(GetTokenTypeAsHandle, GetTokenTypeAsHandleValue, DWORDLONG)
Expand Down
42 changes: 0 additions & 42 deletions src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5940,48 +5940,6 @@ const WCHAR* MethodContext::repAppendClassName(CORINFO_CLASS_HANDLE cls,
return name;
}

void MethodContext::recGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig,
CorInfoHelperTailCallSpecialHandling flags,
void* result)
{
if (GetTailCallCopyArgsThunk == nullptr)
GetTailCallCopyArgsThunk = new LightWeightMap<Agnostic_GetTailCallCopyArgsThunk, DWORDLONG>();

Agnostic_GetTailCallCopyArgsThunk key;
ZeroMemory(&key, sizeof(Agnostic_GetTailCallCopyArgsThunk)); // We use the input structs as a key and use memcmp to
// compare.. so we need to zero out padding too
key.Sig = SpmiRecordsHelper::StoreAgnostic_CORINFO_SIG_INFO(*pSig, GetTailCallCopyArgsThunk);
key.flags = (DWORD)flags;

GetTailCallCopyArgsThunk->Add(key, (DWORDLONG)result);
DEBUG_REC(dmpGetTailCallCopyArgsThunk(key, (DWORDLONG)result));
}

void MethodContext::dmpGetTailCallCopyArgsThunk(const Agnostic_GetTailCallCopyArgsThunk& key, DWORDLONG value)
{
printf("GetTailCallCopyArgsThunk key sig%s flg-%08X",
SpmiDumpHelper::DumpAgnostic_CORINFO_SIG_INFO(key.Sig).c_str(), key.flags);
printf(", value res-%016llX", value);
}

void* MethodContext::repGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
AssertCodeMsg(GetTailCallCopyArgsThunk != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for ...");

Agnostic_GetTailCallCopyArgsThunk key;
ZeroMemory(&key, sizeof(Agnostic_GetTailCallCopyArgsThunk)); // We use the input structs as a key and use memcmp to
// compare.. so we need to zero out padding too
key.Sig = SpmiRecordsHelper::RestoreAgnostic_CORINFO_SIG_INFO(*pSig, GetTailCallCopyArgsThunk);
key.flags = (DWORD)flags;

AssertCodeMsg(GetTailCallCopyArgsThunk->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
(DWORDLONG)key.Sig.retTypeClass);
void* result = (void*)GetTailCallCopyArgsThunk->Get(key);
cr->recAddressMap((void*)0x424242, (void*)result, 1);
DEBUG_REP(dmpGetTailCallCopyArgsThunk(key, (DWORDLONG)result));
return result;
}

void MethodContext::recGetTailCallHelpers(
CORINFO_RESOLVED_TOKEN* callToken,
CORINFO_SIG_INFO* sig,
Expand Down
11 changes: 1 addition & 10 deletions src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,6 @@ class MethodContext
DWORDLONG ProfilerHandle;
DWORD bIndirectedHandles;
};
struct Agnostic_GetTailCallCopyArgsThunk
{
Agnostic_CORINFO_SIG_INFO Sig;
DWORD flags;
};
struct Agnostic_GetTailCallHelpers
{
Agnostic_CORINFO_RESOLVED_TOKEN callToken;
Expand Down Expand Up @@ -1269,10 +1264,6 @@ class MethodContext
void dmpAppendClassName(const Agnostic_AppendClassName& key, DWORD value);
const WCHAR* repAppendClassName(CORINFO_CLASS_HANDLE cls, BOOL fNamespace, BOOL fFullInst, BOOL fAssembly);

void recGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags, void* result);
void dmpGetTailCallCopyArgsThunk(const Agnostic_GetTailCallCopyArgsThunk& key, DWORDLONG value);
void* repGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags);

void recGetTailCallHelpers(
CORINFO_RESOLVED_TOKEN* callToken,
CORINFO_SIG_INFO* sig,
Expand Down Expand Up @@ -1464,7 +1455,7 @@ enum mcPackets
Packet_GetRelocTypeHint = 84,
Packet_GetSecurityPrologHelper = 85, // Retired 2/18/2020
Packet_GetSharedCCtorHelper = 86,
Packet_GetTailCallCopyArgsThunk = 87,
Packet_GetTailCallCopyArgsThunk = 87, // Retired 4/27/2020
Packet_GetTailCallHelpers = 178, // Added 3/18/2020
Packet_GetThreadTLSIndex = 88,
Packet_GetTokenTypeAsHandle = 89,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1857,15 +1857,6 @@ void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
original_ICorJitInfo->MethodCompileComplete(methHnd);
}

// return a thunk that will copy the arguments for the given signature.
void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
mc->cr->AddCall("getTailCallCopyArgsThunk");
void* result = original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
mc->recGetTailCallCopyArgsThunk(pSig, flags, result);
return result;
}

bool interceptor_ICJI::getTailCallHelpers(
CORINFO_RESOLVED_TOKEN* callToken,
CORINFO_SIG_INFO* sig,
Expand Down Expand Up @@ -2106,4 +2097,4 @@ DWORD interceptor_ICJI::getExpectedTargetArchitecture()
void interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported)
{
original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1442,13 +1442,6 @@ void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
original_ICorJitInfo->MethodCompileComplete(methHnd);
}

// return a thunk that will copy the arguments for the given signature.
void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
mcs->AddCall("getTailCallCopyArgsThunk");
return original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
}

bool interceptor_ICJI::getTailCallHelpers(
CORINFO_RESOLVED_TOKEN* callToken,
CORINFO_SIG_INFO* sig,
Expand Down Expand Up @@ -1678,4 +1671,4 @@ void interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instruct
{
mcs->AddCall("notifyInstructionSetUsage");
original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1285,12 +1285,6 @@ void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
original_ICorJitInfo->MethodCompileComplete(methHnd);
}

// return a thunk that will copy the arguments for the given signature.
void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
return original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
}

bool interceptor_ICJI::getTailCallHelpers(
CORINFO_RESOLVED_TOKEN* callToken,
CORINFO_SIG_INFO* sig,
Expand Down
7 changes: 0 additions & 7 deletions src/coreclr/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1540,13 +1540,6 @@ void MyICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
DebugBreakorAV(118);
}

// return a thunk that will copy the arguments for the given signature.
void* MyICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
jitInstance->mc->cr->AddCall("getTailCallCopyArgsThunk");
return jitInstance->mc->repGetTailCallCopyArgsThunk(pSig, flags);
}

bool MyICJI::getTailCallHelpers(
CORINFO_RESOLVED_TOKEN* callToken,
CORINFO_SIG_INFO* sig,
Expand Down
25 changes: 5 additions & 20 deletions src/coreclr/src/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ TODO: Talk about initializing strutures before use
#endif
#endif

SELECTANY const GUID JITEEVersionIdentifier = { /* 108808e4-71b3-4573-8371-323323c4fb80 */
0x108808e4,
0x71b3,
0x4573,
{0x83, 0x71, 0x32, 0x33, 0x23, 0xc4, 0xfb, 0x80}
SELECTANY const GUID JITEEVersionIdentifier = { /* bb6ea6c3-ce5a-4543-86b7-c9c88f9ec780 */
0xbb6ea6c3,
0xce5a,
0x4543,
{ 0x86, 0xb7, 0xc9, 0xc8, 0x8f, 0x9e, 0xc7, 0x80 }
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1075,15 +1075,6 @@ enum CorInfoIndirectCallReason
CORINFO_INDIRECT_CALL_COUNT
};

// When using CORINFO_HELPER_TAILCALL, the JIT needs to pass certain special
// calling convention/argument passing/handling details to the helper
enum CorInfoHelperTailCallSpecialHandling
{
CORINFO_TAILCALL_NORMAL = 0x00000000,
CORINFO_TAILCALL_STUB_DISPATCH_ARG = 0x00000001,
};


inline bool dontInline(CorInfoInline val) {
return(val < 0);
}
Expand Down Expand Up @@ -3140,12 +3131,6 @@ class ICorDynamicInfo : public ICorStaticInfo
CORINFO_METHOD_HANDLE methHnd
) = 0;

// return a thunk that will copy the arguments for the given signature.
virtual void* getTailCallCopyArgsThunk (
CORINFO_SIG_INFO *pSig,
CorInfoHelperTailCallSpecialHandling flags
) = 0;

// Obtain tailcall help for the specified call site.
virtual bool getTailCallHelpers(

Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/src/inc/jithelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,15 @@

JITHELPER(CORINFO_HELP_PINVOKE_CALLI, GenericPInvokeCalliHelper, CORINFO_HELP_SIG_NO_ALIGN_STUB)

#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
JITHELPER(CORINFO_HELP_TAILCALL, JIT_TailCall, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#else
JITHELPER(CORINFO_HELP_TAILCALL, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#endif

JITHELPER(CORINFO_HELP_GETCURRENTMANAGEDTHREADID, JIT_GetCurrentManagedThreadId, CORINFO_HELP_SIG_REG_ONLY)

#ifdef HOST_64BIT
#ifdef TARGET_64BIT
JITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, JIT_InitPInvokeFrame, CORINFO_HELP_SIG_REG_ONLY)
#else
DYNAMICJITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, NULL, CORINFO_HELP_SIG_REG_ONLY)
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/src/inc/vptr_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ VPTR_CLASS(RangeSectionStubManager)
VPTR_CLASS(ILStubManager)
VPTR_CLASS(InteropDispatchStubManager)
VPTR_CLASS(DelegateInvokeStubManager)
#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
VPTR_CLASS(TailCallStubManager)
#endif
VPTR_CLASS(CallCountingStubManager)
VPTR_CLASS(PEFile)
VPTR_CLASS(PEAssembly)
Expand Down Expand Up @@ -93,7 +95,9 @@ VPTR_CLASS(DynamicHelperFrame)
#if defined(TARGET_X86)
VPTR_CLASS(UMThkCallFrame)
#endif
#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
VPTR_CLASS(TailCallFrame)
#endif
VPTR_CLASS(ExceptionFilterFrame)

#ifdef _DEBUG
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/jit/ICorJitInfo_API_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ DEF_CLR_API(setOverride)
DEF_CLR_API(addActiveDependency)
DEF_CLR_API(GetDelegateCtor)
DEF_CLR_API(MethodCompileComplete)
DEF_CLR_API(getTailCallCopyArgsThunk)
DEF_CLR_API(getTailCallHelpers)
DEF_CLR_API(convertPInvokeCalliToCall)
DEF_CLR_API(notifyInstructionSetUsage)
DEF_CLR_API(getMemoryManager)
Expand Down
16 changes: 9 additions & 7 deletions src/coreclr/src/jit/ICorJitInfo_API_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,13 +1476,15 @@ void WrapICorJitInfo::MethodCompileComplete(
API_LEAVE(MethodCompileComplete);
}

void* WrapICorJitInfo::getTailCallCopyArgsThunk(
CORINFO_SIG_INFO *pSig,
CorInfoHelperTailCallSpecialHandling flags)
{
API_ENTER(getTailCallCopyArgsThunk);
void *result = wrapHnd->getTailCallCopyArgsThunk(pSig, flags);
API_LEAVE(getTailCallCopyArgsThunk);
void* WrapICorJitInfo::getTailCallHelpers(
CORINFO_RESOLVED_TOKEN* callToken,
CORINFO_SIG_INFO* sig,
CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
CORINFO_TAILCALL_HELPERS* pResult)
{
API_ENTER(getTailCallHelpers);
void *result = wrapHnd->getTailCallHelpers(callToken, sig, flags, pResult);
API_LEAVE(getTailCallHelpers);
return result;
}

Expand Down
Loading

0 comments on commit bd34833

Please sign in to comment.