Skip to content

Commit 157996f

Browse files
Delete some dead code (#87249)
I went through RuntimeImports looking for things that looked unnecessary. The rest of this PR is basically "stuff that came out after pulling on a loose thread of a sweater".
1 parent 90b416a commit 157996f

21 files changed

+4
-934
lines changed

src/coreclr/nativeaot/Runtime/AsmOffsets.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,6 @@ ASM_OFFSET( 10, 20, InterfaceDispatchCache, m_rgEntries)
7272
ASM_SIZEOF( 8, 10, InterfaceDispatchCacheEntry)
7373
#endif
7474

75-
#ifdef FEATURE_DYNAMIC_CODE
76-
ASM_OFFSET( 0, 0, CallDescrData, pSrc)
77-
ASM_OFFSET( 4, 8, CallDescrData, numStackSlots)
78-
ASM_OFFSET( 8, C, CallDescrData, fpReturnSize)
79-
ASM_OFFSET( C, 10, CallDescrData, pArgumentRegisters)
80-
ASM_OFFSET( 10, 18, CallDescrData, pFloatArgumentRegisters)
81-
ASM_OFFSET( 14, 20, CallDescrData, pTarget)
82-
ASM_OFFSET( 18, 28, CallDescrData, pReturnBuffer)
83-
#endif
84-
8575
// Undefine macros that are only used in this header for convenience.
8676
#undef ASM_OFFSET
8777
#undef ASM_SIZEOF

src/coreclr/nativeaot/Runtime/AsmOffsetsVerify.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "RuntimeInstance.h"
1717
#include "CachedInterfaceDispatch.h"
1818
#include "shash.h"
19-
#include "CallDescr.h"
2019

2120
class AsmOffsets
2221
{

src/coreclr/nativeaot/Runtime/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ endif (CLR_CMAKE_TARGET_ARCH_AMD64 AND CLR_CMAKE_TARGET_WIN32)
196196

197197
list(APPEND RUNTIME_SOURCES_ARCH_ASM
198198
${ARCH_SOURCES_DIR}/AllocFast.${ASM_SUFFIX}
199-
${ARCH_SOURCES_DIR}/CallDescrWorker.${ASM_SUFFIX}
200199
${ARCH_SOURCES_DIR}/ExceptionHandling.${ASM_SUFFIX}
201200
${ARCH_SOURCES_DIR}/GcProbe.${ASM_SUFFIX}
202201
${ARCH_SOURCES_DIR}/Interlocked.${ASM_SUFFIX}

src/coreclr/nativeaot/Runtime/CallDescr.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/coreclr/nativeaot/Runtime/MiscHelpers.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,6 @@ COOP_PINVOKE_HELPER(HANDLE, RhGetOSModuleFromPointer, (PTR_VOID pPointerVal))
121121
return NULL;
122122
}
123123

124-
COOP_PINVOKE_HELPER(HANDLE, RhGetOSModuleFromEEType, (MethodTable * pEEType))
125-
{
126-
return pEEType->GetTypeManagerPtr()->AsTypeManager()->GetOsModuleHandle();
127-
}
128-
129-
COOP_PINVOKE_HELPER(TypeManagerHandle, RhGetModuleFromEEType, (MethodTable * pEEType))
130-
{
131-
return *pEEType->GetTypeManagerPtr();
132-
}
133-
134124
COOP_PINVOKE_HELPER(FC_BOOL_RET, RhFindBlob, (TypeManagerHandle *pTypeManagerHandle, uint32_t blobId, uint8_t ** ppbBlob, uint32_t * pcbBlob))
135125
{
136126
TypeManagerHandle typeManagerHandle = *pTypeManagerHandle;
@@ -350,18 +340,6 @@ COOP_PINVOKE_HELPER(uint8_t *, RhGetCodeTarget, (uint8_t * pCodeOrg))
350340
return pCodeOrg;
351341
}
352342

353-
// Get the universal transition thunk. If the universal transition stub is called through
354-
// the normal PE static linkage model, a jump stub would be used which may interfere with
355-
// the custom calling convention of the universal transition thunk. So instead, a special
356-
// api just for getting the thunk address is needed.
357-
// TODO: On ARM this may still result in a jump stub that trashes R12. Determine if anything
358-
// needs to be done about that when we implement the stub for ARM.
359-
extern "C" void RhpUniversalTransition();
360-
COOP_PINVOKE_HELPER(void*, RhGetUniversalTransitionThunk, ())
361-
{
362-
return (void*)RhpUniversalTransition;
363-
}
364-
365343
extern CrstStatic g_ThunkPoolLock;
366344

367345
EXTERN_C NATIVEAOT_API void __cdecl RhpAcquireThunkPoolLock()

src/coreclr/nativeaot/Runtime/PalRedhawk.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,6 @@ REDHAWK_PALIMPORT uint32_t REDHAWK_PALAPI PalEventUnregister(REGHANDLE arg1);
752752
REDHAWK_PALIMPORT uint32_t REDHAWK_PALAPI PalEventWrite(REGHANDLE arg1, const EVENT_DESCRIPTOR * arg2, uint32_t arg3, EVENT_DATA_DESCRIPTOR * arg4);
753753
#endif
754754

755-
REDHAWK_PALIMPORT _Ret_maybenull_ void* REDHAWK_PALAPI PalSetWerDataBuffer(_In_ void* pNewBuffer);
756-
757755
REDHAWK_PALIMPORT UInt32_BOOL REDHAWK_PALAPI PalAllocateThunksFromTemplate(_In_ HANDLE hTemplateModule, uint32_t templateRva, size_t templateSize, _Outptr_result_bytebuffer_(templateSize) void** newThunksOut);
758756
REDHAWK_PALIMPORT UInt32_BOOL REDHAWK_PALAPI PalFreeThunksFromTemplate(_In_ void *pBaseAddress);
759757

src/coreclr/nativeaot/Runtime/RuntimeInstance.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ bool ShouldHijackForGcStress(uintptr_t CallsiteIP, HijackType ht);
3535

3636
#include "shash.inl"
3737

38-
#ifndef DACCESS_COMPILE
39-
COOP_PINVOKE_HELPER(uint8_t *, RhSetErrorInfoBuffer, (uint8_t * pNewBuffer))
40-
{
41-
return (uint8_t *) PalSetWerDataBuffer(pNewBuffer);
42-
}
43-
#endif // DACCESS_COMPILE
44-
45-
4638
ThreadStore * RuntimeInstance::GetThreadStore()
4739
{
4840
return m_pThreadStore;

src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp

Lines changed: 2 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ GVAL_IMPL_INIT(PTR_VOID, g_ReturnFromUniversalTransitionAddr, PointerToReturnFro
4444

4545
EXTERN_C PTR_VOID PointerToReturnFromUniversalTransition_DebugStepTailCall;
4646
GVAL_IMPL_INIT(PTR_VOID, g_ReturnFromUniversalTransition_DebugStepTailCallAddr, PointerToReturnFromUniversalTransition_DebugStepTailCall);
47-
48-
EXTERN_C PTR_VOID PointerToReturnFromCallDescrThunk;
49-
GVAL_IMPL_INIT(PTR_VOID, g_ReturnFromCallDescrThunkAddr, PointerToReturnFromCallDescrThunk);
5047
#endif
5148

5249
#ifdef TARGET_X86
@@ -1200,130 +1197,6 @@ void StackFrameIterator::UnwindUniversalTransitionThunk()
12001197
#define STACK_ALIGN_SIZE 4
12011198
#endif
12021199

1203-
#ifdef TARGET_AMD64
1204-
struct CALL_DESCR_CONTEXT
1205-
{
1206-
uintptr_t Rbp;
1207-
uintptr_t Rsi;
1208-
uintptr_t Rbx;
1209-
uintptr_t IP;
1210-
};
1211-
#elif defined(TARGET_ARM)
1212-
struct CALL_DESCR_CONTEXT
1213-
{
1214-
uintptr_t R4;
1215-
uintptr_t R5;
1216-
uintptr_t R7;
1217-
uintptr_t IP;
1218-
};
1219-
#elif defined(TARGET_ARM64)
1220-
struct CALL_DESCR_CONTEXT
1221-
{
1222-
uintptr_t FP;
1223-
uintptr_t IP;
1224-
uintptr_t X19;
1225-
uintptr_t X20;
1226-
};
1227-
#elif defined(TARGET_X86)
1228-
struct CALL_DESCR_CONTEXT
1229-
{
1230-
uintptr_t Rbx;
1231-
uintptr_t Rbp;
1232-
uintptr_t IP;
1233-
};
1234-
#elif defined (TARGET_WASM)
1235-
struct CALL_DESCR_CONTEXT
1236-
{
1237-
uintptr_t IP;
1238-
};
1239-
#else
1240-
#error NYI - For this arch
1241-
#endif
1242-
1243-
typedef DPTR(CALL_DESCR_CONTEXT) PTR_CALL_DESCR_CONTEXT;
1244-
1245-
void StackFrameIterator::UnwindCallDescrThunk()
1246-
{
1247-
ASSERT((m_dwFlags & MethodStateCalculated) == 0);
1248-
1249-
#if defined(USE_PORTABLE_HELPERS) // @TODO: Corresponding helper code is only defined in assembly code
1250-
return;
1251-
#else // defined(USE_PORTABLE_HELPERS)
1252-
ASSERT(CategorizeUnadjustedReturnAddress(m_ControlPC) == InCallDescrThunk);
1253-
1254-
uintptr_t newSP;
1255-
#ifdef TARGET_AMD64
1256-
// RBP points to the SP that we want to capture. (This arrangement allows for
1257-
// the arguments from this function to be loaded into memory with an adjustment
1258-
// to SP, like an alloca
1259-
newSP = *(PTR_UIntNative)m_RegDisplay.pRbp;
1260-
1261-
PTR_CALL_DESCR_CONTEXT pContext = (PTR_CALL_DESCR_CONTEXT)newSP;
1262-
1263-
m_RegDisplay.pRbp = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, Rbp);
1264-
m_RegDisplay.pRsi = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, Rsi);
1265-
m_RegDisplay.pRbx = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, Rbx);
1266-
1267-
// And adjust SP to be the state that it should be in just after returning from
1268-
// the CallDescrFunction
1269-
newSP += sizeof(CALL_DESCR_CONTEXT);
1270-
#elif defined(TARGET_ARM)
1271-
// R7 points to the SP that we want to capture. (This arrangement allows for
1272-
// the arguments from this function to be loaded into memory with an adjustment
1273-
// to SP, like an alloca
1274-
newSP = *(PTR_UIntNative)m_RegDisplay.pR7;
1275-
PTR_CALL_DESCR_CONTEXT pContext = (PTR_CALL_DESCR_CONTEXT)newSP;
1276-
1277-
m_RegDisplay.pR4 = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, R4);
1278-
m_RegDisplay.pR5 = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, R5);
1279-
m_RegDisplay.pR7 = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, R7);
1280-
1281-
// And adjust SP to be the state that it should be in just after returning from
1282-
// the CallDescrFunction
1283-
newSP += sizeof(CALL_DESCR_CONTEXT);
1284-
1285-
#elif defined(TARGET_ARM64)
1286-
// pFP points to the SP that we want to capture. (This arrangement allows for
1287-
// the arguments from this function to be loaded into memory with an adjustment
1288-
// to SP, like an alloca
1289-
newSP = *(PTR_UIntNative)m_RegDisplay.pFP;
1290-
PTR_CALL_DESCR_CONTEXT pContext = (PTR_CALL_DESCR_CONTEXT)newSP;
1291-
1292-
m_RegDisplay.pX19 = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, X19);
1293-
m_RegDisplay.pX20 = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, X20);
1294-
1295-
// And adjust SP to be the state that it should be in just after returning from
1296-
// the CallDescrFunction
1297-
newSP += sizeof(CALL_DESCR_CONTEXT);
1298-
1299-
#elif defined(TARGET_X86)
1300-
// RBP points to the SP that we want to capture. (This arrangement allows for
1301-
// the arguments from this function to be loaded into memory with an adjustment
1302-
// to SP, like an alloca
1303-
newSP = *(PTR_UIntNative)m_RegDisplay.pRbp;
1304-
1305-
PTR_CALL_DESCR_CONTEXT pContext = (PTR_CALL_DESCR_CONTEXT)(newSP - offsetof(CALL_DESCR_CONTEXT, Rbp));
1306-
1307-
m_RegDisplay.pRbp = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, Rbp);
1308-
m_RegDisplay.pRbx = PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, Rbx);
1309-
1310-
// And adjust SP to be the state that it should be in just after returning from
1311-
// the CallDescrFunction
1312-
newSP += sizeof(CALL_DESCR_CONTEXT) - offsetof(CALL_DESCR_CONTEXT, Rbp);
1313-
1314-
#else
1315-
PORTABILITY_ASSERT("UnwindCallDescrThunk");
1316-
PTR_CALL_DESCR_CONTEXT pContext = NULL;
1317-
#endif
1318-
1319-
m_RegDisplay.SetAddrOfIP(PTR_TO_MEMBER(CALL_DESCR_CONTEXT, pContext, IP));
1320-
m_RegDisplay.SetIP(pContext->IP);
1321-
m_RegDisplay.SetSP(newSP);
1322-
SetControlPC(dac_cast<PTR_VOID>(pContext->IP));
1323-
1324-
#endif // defined(USE_PORTABLE_HELPERS)
1325-
}
1326-
13271200
void StackFrameIterator::UnwindThrowSiteThunk()
13281201
{
13291202
ASSERT((m_dwFlags & MethodStateCalculated) == 0);
@@ -1659,11 +1532,7 @@ void StackFrameIterator::UnwindNonEHThunkSequence()
16591532
{
16601533
ASSERT(m_pConservativeStackRangeLowerBound == NULL);
16611534

1662-
if (category == InCallDescrThunk)
1663-
{
1664-
UnwindCallDescrThunk();
1665-
}
1666-
else if (category == InUniversalTransitionThunk)
1535+
if (category == InUniversalTransitionThunk)
16671536
{
16681537
UnwindUniversalTransitionThunk();
16691538
ASSERT(m_pConservativeStackRangeLowerBound != NULL);
@@ -1856,7 +1725,6 @@ bool StackFrameIterator::IsNonEHThunk(ReturnAddressCategory category)
18561725
default:
18571726
return false;
18581727
case InUniversalTransitionThunk:
1859-
case InCallDescrThunk:
18601728
return true;
18611729
}
18621730
}
@@ -1926,11 +1794,7 @@ StackFrameIterator::ReturnAddressCategory StackFrameIterator::CategorizeUnadjust
19261794
#else // defined(USE_PORTABLE_HELPERS)
19271795

19281796
#if defined(FEATURE_DYNAMIC_CODE)
1929-
if (EQUALS_RETURN_ADDRESS(returnAddress, ReturnFromCallDescrThunk))
1930-
{
1931-
return InCallDescrThunk;
1932-
}
1933-
else if (EQUALS_RETURN_ADDRESS(returnAddress, ReturnFromUniversalTransition) ||
1797+
if (EQUALS_RETURN_ADDRESS(returnAddress, ReturnFromUniversalTransition) ||
19341798
EQUALS_RETURN_ADDRESS(returnAddress, ReturnFromUniversalTransition_DebugStepTailCall))
19351799
{
19361800
return InUniversalTransitionThunk;

src/coreclr/nativeaot/Runtime/StackFrameIterator.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ class StackFrameIterator
7979
// NOTE: This function always publishes a non-NULL conservative stack range lower bound.
8080
void UnwindUniversalTransitionThunk();
8181

82-
// If our control PC indicates that we're in the call descr thunk that we use to call an arbitrary managed
83-
// function with an arbitrary signature from a normal managed function handle the stack walk specially.
84-
void UnwindCallDescrThunk();
85-
8682
void EnterInitialInvalidState(Thread * pThreadToWalk);
8783

8884
void InternalInit(Thread * pThreadToWalk, PTR_PInvokeTransitionFrame pFrame, uint32_t dwFlags); // GC stackwalk
@@ -115,7 +111,6 @@ class StackFrameIterator
115111
InThrowSiteThunk,
116112
InFuncletInvokeThunk,
117113
InFilterFuncletInvokeThunk,
118-
InCallDescrThunk,
119114
InUniversalTransitionThunk,
120115
};
121116

src/coreclr/nativeaot/Runtime/amd64/CallDescrWorker.S

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)