Skip to content

Commit f7fc178

Browse files
authored
Revert "Create a single copy of stub templates (dotnet#114462)" (dotnet#115665)
This reverts commit ac760bf.
1 parent 3c8bae3 commit f7fc178

File tree

16 files changed

+50
-904
lines changed

16 files changed

+50
-904
lines changed

src/coreclr/clrdefinitions.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,6 @@ if (FEATURE_STUBPRECODE_DYNAMIC_HELPERS)
218218
add_definitions(-DFEATURE_STUBPRECODE_DYNAMIC_HELPERS)
219219
endif()
220220

221-
if (CLR_CMAKE_TARGET_APPLE)
222-
add_definitions(-DFEATURE_MAP_THUNKS_FROM_IMAGE)
223-
endif()
224-
225221
# Use this function to enable building with a specific target OS and architecture set of defines
226222
# This is known to work for the set of defines used by the JIT and gcinfo, it is not likely correct for
227223
# other components of the runtime

src/coreclr/inc/executableallocator.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ class ExecutableAllocator
182182
// Return true if double mapping is enabled.
183183
static bool IsDoubleMappingEnabled();
184184

185-
// Release memory allocated via DoubleMapping for either templates or normal double mapped data
186-
void ReleaseWorker(void* pRX, bool releaseTemplate);
187-
188185
// Initialize the allocator instance
189186
bool Initialize();
190187

@@ -265,18 +262,6 @@ class ExecutableAllocator
265262

266263
// Unmap the RW mapping at the specified address
267264
void UnmapRW(void* pRW);
268-
269-
// Allocate thunks from a template. pTemplate is the return value from CreateTemplate
270-
void* AllocateThunksFromTemplate(void *pTemplate, size_t templateSize);
271-
272-
// Free a set of thunks allocated from templates. pThunks must have been returned from AllocateThunksFromTemplate
273-
void FreeThunksFromTemplate(void *pThunks, size_t templateSize);
274-
275-
// Create a template
276-
// If templateInImage is not null, it will attempt to use it as the template, otherwise it will create an temporary in memory file to serve as the template
277-
// Some OS/Architectures may/may not be able to work with this, so this api is permitted to return NULL, and callers should have an alternate approach using
278-
// the codePageGenerator directly.
279-
void* CreateTemplate(void* templateInImage, size_t templateSize, void (*codePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size));
280265
};
281266

282267
#define ExecutableWriterHolder ExecutableWriterHolderNoLog

src/coreclr/inc/loaderheap.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -455,19 +455,10 @@ class UnlockedLoaderHeap : public UnlockedLoaderHeapBase
455455
static void WeGotAFaultNowWhat(UnlockedLoaderHeap *pHeap);
456456
};
457457

458-
struct InterleavedLoaderHeapConfig
459-
{
460-
uint32_t StubSize;
461-
void* Template;
462-
void (*CodePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size);
463-
};
464-
465-
void InitializeLoaderHeapConfig(InterleavedLoaderHeapConfig *pConfig, size_t stubSize, void* templateInImage, void (*codePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size));
466-
467458
//===============================================================================
468459
// This is the base class for InterleavedLoaderHeap It's used as a simple
469460
// allocator for stubs in a scheme where each stub is a small fixed size, and is paired
470-
// with memory which is GetStubCodePageSize() bytes away. In addition there is an
461+
// with memory which is GetOSStubPageSize() bytes away. In addition there is an
471462
// ability to free is via a "backout" mechanism that is not considered to have good performance.
472463
//
473464
//===============================================================================
@@ -501,13 +492,16 @@ class UnlockedInterleavedLoaderHeap : public UnlockedLoaderHeapBase
501492

502493
InterleavedStubFreeListNode *m_pFreeListHead;
503494

504-
const InterleavedLoaderHeapConfig *m_pConfig;
495+
public:
496+
public:
497+
void (*m_codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size);
505498

506499
#ifndef DACCESS_COMPILE
507500
protected:
508501
UnlockedInterleavedLoaderHeap(
509502
RangeList *pRangeList,
510-
const InterleavedLoaderHeapConfig *pConfig);
503+
void (*codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size),
504+
DWORD dwGranularity);
511505

512506
virtual ~UnlockedInterleavedLoaderHeap();
513507
#endif
@@ -1045,11 +1039,13 @@ class InterleavedLoaderHeap : public UnlockedInterleavedLoaderHeap
10451039
public:
10461040
InterleavedLoaderHeap(RangeList *pRangeList,
10471041
BOOL fUnlocked,
1048-
const InterleavedLoaderHeapConfig *pConfig
1042+
void (*codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size),
1043+
DWORD dwGranularity
10491044
)
10501045
: UnlockedInterleavedLoaderHeap(
10511046
pRangeList,
1052-
pConfig),
1047+
codePageGenerator,
1048+
dwGranularity),
10531049
m_CriticalSection(fUnlocked ? NULL : CreateLoaderHeapLock())
10541050
{
10551051
WRAPPER_NO_CONTRACT;

0 commit comments

Comments
 (0)