summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McKinsey <chrismck@microsoft.com>2015-04-02 13:09:44 -0700
committerChris McKinsey <chrismck@microsoft.com>2015-04-02 13:23:31 -0700
commitdf886a58dd4594ce942fa7ee78f6bff8f472cb5c (patch)
tree0d86ced180a0e3b779ac0356b842843c0ccc6546
parentcf104b93a168f7aaff7c14113b2f80106bbcc405 (diff)
downloadcoreclr-df886a58dd4594ce942fa7ee78f6bff8f472cb5c.tar.gz
coreclr-df886a58dd4594ce942fa7ee78f6bff8f472cb5c.tar.bz2
coreclr-df886a58dd4594ce942fa7ee78f6bff8f472cb5c.zip
CQ fix for generic handle lookup in GenericHandleWorker
When looking up the runtime handle in the generic handle cache for a methodtable we get the declaring methodtable in the hierarchy and then lookup the handle in the cache from that methodtable. When found we should insert the handle back into the table using the original methodtable as the key and not the declaring MT so that later lookups are faster. Inserting the handle back into the table under the original key was a noop. Desktop DDR and JITSH testing clean. The test case in Github issue #55 is now 3x faster. Benchmarked roslyn performance which shows no change in performance.
-rw-r--r--src/vm/jithelpers.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp
index d93228d744..dc1a76c9e5 100644
--- a/src/vm/jithelpers.cpp
+++ b/src/vm/jithelpers.cpp
@@ -3742,7 +3742,8 @@ JIT_GenericHandleWorker(
{
// Add the denormalized key for faster lookup next time. This is not a critical entry - no need
// to specify appdomain affinity.
- AddToGenericHandleCache(&key, res);
+ JitGenericHandleCacheKey denormKey((CORINFO_CLASS_HANDLE)pMT, NULL, signature);
+ AddToGenericHandleCache(&denormKey, res);
return (CORINFO_GENERIC_HANDLE) (DictionaryEntry) res;
}
}
@@ -3765,6 +3766,8 @@ JIT_GenericHandleWorker(
pDictDomain = pMD->GetDomain();
}
+ // Add the normalized key (pDeclaringMT) here so that future lookups of any
+ // inherited types are faster next time rather than just just for this specific pMT.
JitGenericHandleCacheKey key((CORINFO_CLASS_HANDLE)pDeclaringMT, (CORINFO_METHOD_HANDLE)pMD, signature, pDictDomain);
AddToGenericHandleCache(&key, (HashDatum)result);
}