summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Sullivan <briansul@microsoft.com>2017-08-01 15:28:16 -0700
committerGitHub <noreply@github.com>2017-08-01 15:28:16 -0700
commitb5c3e56065f640774d75f30acd548d3478874dcb (patch)
treed699d26e4b033cafda56ddd2613da9e66378e8f9
parent2293b72929a27df38c66a3bab26fe06e5cb804fd (diff)
parent1f2676e691f65e261591ea2a1e818340df41cfcb (diff)
downloadcoreclr-b5c3e56065f640774d75f30acd548d3478874dcb.tar.gz
coreclr-b5c3e56065f640774d75f30acd548d3478874dcb.tar.bz2
coreclr-b5c3e56065f640774d75f30acd548d3478874dcb.zip
Merge pull request #12856 from briansull/method-referenced-ibcdata
Record references to all of the hot methods specified by the IBC profile data
-rw-r--r--src/vm/ceeload.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp
index fd5d2b12c5..074d241798 100644
--- a/src/vm/ceeload.cpp
+++ b/src/vm/ceeload.cpp
@@ -7928,6 +7928,55 @@ void Module::ExpandAll(DataImage *image)
_ASSERTE(pBlobEntry->type == EndOfBlobStream);
}
+ //
+ // Record references to all of the hot methods specifiled by MethodProfilingData array
+ // We call MethodReferencedByCompiledCode to indicate that we plan on compiling this method
+ //
+ CORBBTPROF_TOKEN_INFO * pMethodProfilingData = profileData->GetTokenFlagsData(MethodProfilingData);
+ DWORD cMethodProfilingData = profileData->GetTokenFlagsCount(MethodProfilingData);
+ for (unsigned int i = 0; (i < cMethodProfilingData); i++)
+ {
+ mdToken token = pMethodProfilingData[i].token;
+ DWORD profilingFlags = pMethodProfilingData[i].flags;
+
+ // We call MethodReferencedByCompiledCode only when the profile data indicates that
+ // we executed (i.e read) the code for the method
+ //
+ if (profilingFlags & (1 << ReadMethodCode))
+ {
+ if (TypeFromToken(token) == mdtMethodDef)
+ {
+ MethodDesc * pMD = LookupMethodDef(token);
+ //
+ // Record a reference to a hot non-generic method
+ //
+ image->GetPreloader()->MethodReferencedByCompiledCode((CORINFO_METHOD_HANDLE)pMD);
+ }
+ else if (TypeFromToken(token) == ibcMethodSpec)
+ {
+ CORBBTPROF_BLOB_PARAM_SIG_ENTRY *pBlobSigEntry = profileData->GetBlobSigEntry(token);
+
+ if (pBlobSigEntry != NULL)
+ {
+ _ASSERTE(pBlobSigEntry->blob.token == token);
+ MethodDesc * pMD = LoadIBCMethodHelper(image, pBlobSigEntry);
+
+ if (pMD != NULL)
+ {
+ // Occasionally a non-instantiated generic method shows up in the IBC data, we should NOT compile it.
+ if (!pMD->IsTypicalMethodDefinition())
+ {
+ //
+ // Record a reference to a hot instantiated generic method
+ //
+ image->GetPreloader()->MethodReferencedByCompiledCode((CORINFO_METHOD_HANDLE)pMD);
+ }
+ }
+ }
+ }
+ }
+ }
+
{
//
// Fill out MemberRef RID map and va sig cookies for