Skip to content

Commit 16414dd

Browse files
authored
Enable caching of writeable W^X mappings (#74526)
This change enables caching of the last used writeable mapping for W^X. It was originally disabled by an ifdef, but after we've turned W^X on by default, performance tests have shown a regression in some regex tests. I have investigated those and found that they do excessive amount of jitting (around 50000 methods). Enabling the caching of the last used writeable mapping fixes the regression completely. The caching implementation was present in the sources ever since I've implemented the W^X stuff, but if was disabled by an ifdef. So this change just defines the related symbol and enables the code. The caching basically just keeps a writeable mapping after unmapping until the next mapping request arrives, so it gives an opportunity to reuse it in case of series of mappings of sequential range of executable memory, which happens e.g. in the case mentioned.
1 parent 7a4b0af commit 16414dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/coreclr/utilcode/executableallocator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ bool ExecutableAllocator::Initialize()
259259
return true;
260260
}
261261

262-
//#define ENABLE_CACHED_MAPPINGS
262+
#define ENABLE_CACHED_MAPPINGS
263263

264264
void ExecutableAllocator::UpdateCachedMapping(BlockRW* pBlock)
265265
{

0 commit comments

Comments
 (0)