summaryrefslogtreecommitdiff
path: root/src/vm/dynamicmethod.h
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2017-11-30 23:21:40 -0800
committerGitHub <noreply@github.com>2017-11-30 23:21:40 -0800
commitc1e44d9db9cc0d03e5f44af665acefa3589a6883 (patch)
tree2b9ad535324b85548de84a5eec8eabfe39ca3de5 /src/vm/dynamicmethod.h
parent845c2c248c6450107acd37c5469f56d05b391183 (diff)
downloadcoreclr-c1e44d9db9cc0d03e5f44af665acefa3589a6883.tar.gz
coreclr-c1e44d9db9cc0d03e5f44af665acefa3589a6883.tar.bz2
coreclr-c1e44d9db9cc0d03e5f44af665acefa3589a6883.zip
Jumpstub fixes (#15296)
- Reserve space for jump stubs for precodes and other code fragments at the end of each code heap segment. This is trying to ensure that eventual allocation of jump stubs for precodes and other code fragments succeeds. Accounting is done conservatively - reserves more than strictly required. It wastes a bit of address space, but no actual memory. Also, this reserve is not used to allocate jump stubs for JITed code since the JITing can recover from failure to allocate the jump stub now. Fixes #14996. - Improve algorithm to reuse HostCodeHeap segments: Maintain estimated size of the largest free block in HostCodeHeap. This estimate is updated when allocation request fails, and also when memory is returned to the HostCodeHeap. Fixes #14995. - Retry JITing on failure to allocate jump stub. Failure to allocate jump during JITing is not fatal anymore. There is extra memory reserved for jump stubs on retry to ensure that the retry succeeds allocating the jump stubs that it needs with high probability. - Respect CodeHeapRequestInfo::getRequestSize for HostCodeHeap. CodeHeapRequestInfo::getRequestSize is used to throttle code heap segment size for large workloads. Not respecting it in HostCodeHeap lead to too many too small code heap segments in large workloads. - Switch HostCodeHeap nibble map to be allocated on regular heap as part. It simplied the math required to estimate the nibble map size, and allocating on regular heap is overall goodness since it does not need to be executable.
Diffstat (limited to 'src/vm/dynamicmethod.h')
-rw-r--r--src/vm/dynamicmethod.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/vm/dynamicmethod.h b/src/vm/dynamicmethod.h
index 7fd63e59b9..69cd9a9f96 100644
--- a/src/vm/dynamicmethod.h
+++ b/src/vm/dynamicmethod.h
@@ -247,7 +247,7 @@ private:
PTR_BYTE m_pBaseAddr;
PTR_BYTE m_pLastAvailableCommittedAddr;
size_t m_TotalBytesAvailable;
- size_t m_ReservedData;
+ size_t m_ApproximateLargestBlock;
// Heap ref count
DWORD m_AllocationCount;
@@ -260,10 +260,6 @@ private:
TrackAllocation *pNext;
};
size_t size;
-
- // the location of this TrackAllocation record will be stored right before the start of the allocated memory
- // if there is padding between them it will be stored in that padding, otherwise it will be stored in this pad field
- void *pad;
};
TrackAllocation *m_pFreeList;
@@ -275,18 +271,16 @@ public:
static HeapList* CreateCodeHeap(CodeHeapRequestInfo *pInfo, EEJitManager *pJitManager);
private:
- HostCodeHeap(size_t ReserveBlockSize, EEJitManager *pJitManager, CodeHeapRequestInfo *pInfo);
- BYTE* InitCodeHeapPrivateData(size_t ReserveBlockSize, size_t otherData, size_t nibbleMapSize);
- void* AllocFromFreeList(size_t size, DWORD alignment);
+ HostCodeHeap(EEJitManager *pJitManager);
+ HeapList* InitializeHeapList(CodeHeapRequestInfo *pInfo);
+ TrackAllocation* AllocFromFreeList(size_t header, size_t size, DWORD alignment, size_t reserveForJumpStubs);
void AddToFreeList(TrackAllocation *pBlockToInsert);
- static size_t GetPadding(TrackAllocation *pCurrent, size_t size, DWORD alignement);
- void* AllocMemory(size_t size, DWORD alignment);
- void* AllocMemory_NoThrow(size_t size, DWORD alignment);
+ TrackAllocation* AllocMemory_NoThrow(size_t header, size_t size, DWORD alignment, size_t reserveForJumpStubs);
public:
// Space for header is reserved immediately before. It is not included in size.
- virtual void* AllocMemForCode_NoThrow(size_t header, size_t size, DWORD alignment) DAC_EMPTY_RET(NULL);
+ virtual void* AllocMemForCode_NoThrow(size_t header, size_t size, DWORD alignment, size_t reserveForJumpStubs) DAC_EMPTY_RET(NULL);
virtual ~HostCodeHeap() DAC_EMPTY();