This is needed when multiple profiles are played and same methods exist in them.
Without this change, if method was not yet requested in main thread,
it will be jitted as many times in mcj thread as it appears in all profiles.
void StoreMethodCode(MethodDesc * pMethod, MulticoreJitCodeInfo codeInfo);
+ bool LookupMethodCode(MethodDesc * pMethod);
+
MulticoreJitCodeInfo QueryAndRemoveMethodCode(MethodDesc * pMethod);
inline unsigned GetRemainingMethodCount() const
}
+// Check if method is already compiled and stored
+bool MulticoreJitCodeStorage::LookupMethodCode(MethodDesc * pMethod)
+{
+ STANDARD_VM_CONTRACT;
+
+ MulticoreJitCodeInfo codeInfo;
+
+ {
+ CrstHolder holder(& m_crstCodeMap);
+ return m_nativeCodeMap.Lookup(pMethod, &codeInfo);
+ }
+}
+
+
// Query from MakeJitWorker: Lookup stored JITted methods
MulticoreJitCodeInfo MulticoreJitCodeStorage::QueryAndRemoveMethodCode(MethodDesc * pMethod)
{
}
}
- if (pMethod->GetNativeCode() == NULL)
+ if (pMethod->GetNativeCode() == NULL && !GetAppDomain()->GetMulticoreJitManager().GetMulticoreJitCodeStorage().LookupMethodCode(pMethod))
{
if (CompileMethodDesc(pModule, pMethod))
{