-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't re-instrument methods which don't need that #84772
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -12131,6 +12131,26 @@ HRESULT CEEJitInfo::allocPgoInstrumentationBySchema( | |||
codeSize = m_ILHeader->GetCodeSize(); | ||||
} | ||||
|
||||
if (m_pMethodBeingCompiled->IsVersionable()) | ||||
{ | ||||
CodeVersionManager* pCodeVersionManager = m_pMethodBeingCompiled->GetCodeVersionManager(); | ||||
CodeVersionManager::LockHolder codeVersioningLockHolder; | ||||
ILCodeVersion ilVersion = pCodeVersionManager->GetActiveILCodeVersion(m_pMethodBeingCompiled); | ||||
NativeCodeVersion currentVersion = ilVersion.GetActiveNativeCodeVersion(m_pMethodBeingCompiled); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The active code version may have changed meanwhile, so it may not represent the current code version being jitted. Could use something like this instead: runtime/src/coreclr/vm/jitinterface.cpp Line 6681 in 7b662a7
Along with |
||||
|
||||
NativeCodeVersion::OptimizationTier currentOptTier = currentVersion.GetOptimizationTier(); | ||||
if ((currentOptTier == NativeCodeVersion::OptimizationTier::OptimizationTier0) || | ||||
(currentOptTier == NativeCodeVersion::OptimizationTier::OptimizationTier1)) | ||||
{ | ||||
// Current tier is not marked as instrumented, but it requested the schemas so it means it doesn't | ||||
// need to be re-instrumented in future and can be promoted straight to Tier1 if hot enough. | ||||
currentVersion.SetShouldSkipInstrumentation(); | ||||
} | ||||
|
||||
// Leave a note that this method is properly instrumented | ||||
currentVersion.SetInstrumented(); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
AFAIK there isn't a clear place currently where such info could be stored. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it's better to rollback to occupying a spare bit in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The info appears to be specific to a code version rather than a method desc, so I'm not sure the method desc would be an appropriate place for it |
||||
} | ||||
|
||||
#ifdef FEATURE_PGO | ||||
hr = PgoManager::allocPgoInstrumentationBySchema(m_pMethodBeingCompiled, pSchema, countSchemaItems, pInstrumentationData); | ||||
#else | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using an
enum class
to avoid polluting the parent namespace, though this may need to be moved based on my other comment.