diff options
author | Jan Vorlicek <jan.vorlicek@volny.cz> | 2021-05-20 12:02:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-20 12:02:22 +0300 |
commit | 636f89d78efeda58e938534f9b1da1981e6c8575 (patch) | |
tree | 2db3eaa9328a8a3f60fcff818b3fd6f7fe02f668 /src/coreclr/inc | |
parent | 542ef8ba780303a63e628bbcd67d97586428be77 (diff) |
Move metadata off the executable heaps (#52912)
* Move metadata off the executable heaps
This change moves metadata structures that manage blocks of heap memory
out of the heaps in preparation for the W^X changes that will make the
heap memory read-execute only and modifying the metadata would require
unnecessary mappings and unmappings of the memory as read-write.
The structures moved in this change are the following:
* LoaderHeapBlock
* FreeBlock
* HeapList
* Remove unnecessary m_pCurBlock from the UnlockedLoaderHeap
Diffstat (limited to 'src/coreclr/inc')
-rw-r--r-- | src/coreclr/inc/loaderheap.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/coreclr/inc/loaderheap.h b/src/coreclr/inc/loaderheap.h index 68d50f6d637..96fec35be0c 100644 --- a/src/coreclr/inc/loaderheap.h +++ b/src/coreclr/inc/loaderheap.h @@ -201,8 +201,6 @@ private: PTR_BYTE m_pPtrToEndOfCommittedRegion; PTR_BYTE m_pEndReservedRegion; - PTR_LoaderHeapBlock m_pCurBlock; - // When we need to ClrVirtualAlloc() MEM_RESERVE a new set of pages, number of bytes to reserve DWORD m_dwReserveBlockSize; @@ -301,6 +299,12 @@ protected: return m_pEndReservedRegion - m_pAllocPtr; } + PTR_BYTE UnlockedGetAllocPtr() + { + LIMITED_METHOD_CONTRACT; + return m_pAllocPtr; + } + private: // Get some more committed pages - either commit some more in the current reserved region, or, if it // has run out, reserve another set of pages @@ -848,6 +852,18 @@ public: WRAPPER_NO_CONTRACT; return UnlockedGetReservedBytesFree(); } + + PTR_BYTE GetAllocPtr() + { + WRAPPER_NO_CONTRACT; + return UnlockedGetAllocPtr(); + } + + void ReservePages(size_t size) + { + WRAPPER_NO_CONTRACT; + UnlockedReservePages(size); + } }; |