diff options
author | Scott Mosier <smosier@microsoft.com> | 2016-04-29 21:04:50 +0300 |
---|---|---|
committer | Scott Mosier <smosier@microsoft.com> | 2016-04-29 21:04:50 +0300 |
commit | ede47337e4736cda31f963e1dacaf38f1d09e2f5 (patch) | |
tree | f11e071c1264c85b8a4f5d8382eb3eabaf8f95f8 /src/Native/Runtime/MiscHelpers.cpp | |
parent | e71eafae093ab4434e195dada959ac840d968bfc (diff) |
Implement type casting cache
This checkin is an adaptation of a cache used in the type loader. It is applied to our type casting APIs and brings a significant performance improvement to any type-cast-heavy workload.
The cache has an initial tuning that looks reasonable, but should still be considered provisional as we gather more data on its behavior across various workloads.
[tfs-changeset: 1600411]
Diffstat (limited to 'src/Native/Runtime/MiscHelpers.cpp')
-rw-r--r-- | src/Native/Runtime/MiscHelpers.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Native/Runtime/MiscHelpers.cpp b/src/Native/Runtime/MiscHelpers.cpp index 3fda3e52e..9b3f158ab 100644 --- a/src/Native/Runtime/MiscHelpers.cpp +++ b/src/Native/Runtime/MiscHelpers.cpp @@ -644,6 +644,18 @@ COOP_PINVOKE_HELPER(void*, RhGetUniversalTransitionThunk, ()) return (void*)RhpUniversalTransition; } +extern CrstStatic g_CastCacheLock; + +EXTERN_C REDHAWK_API void __cdecl RhpAcquireCastCacheLock() +{ + g_CastCacheLock.Enter(); +} + +EXTERN_C REDHAWK_API void __cdecl RhpReleaseCastCacheLock() +{ + g_CastCacheLock.Leave(); +} + #ifdef CORERT COOP_PINVOKE_HELPER(void*, RhpGetModuleSection, (ModuleManager* pModule, Int32 headerId, Int32* length)) { |