-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Update how OSR and PGO interact #61453
Changes from 3 commits
138893c
1f8800b
44ed72b
e8dadc8
432ca0f
cf0d1b4
bc3a3b9
70f10ce
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 |
---|---|---|
|
@@ -361,6 +361,44 @@ bool ReadInstrumentationSchemaWithLayout(const uint8_t *pByte, size_t cbDataMax, | |
}); | ||
} | ||
|
||
|
||
// Return true if schemaTable entries are a subset of the schema described by pByte, with matching entries in the same order. | ||
// Also updates offset of the matching entries in schemaTable to those of the pByte schema. | ||
// | ||
inline bool ComparePgoSchemaCompatible(const uint8_t *pByte, size_t cbDataMax, ICorJitInfo::PgoInstrumentationSchema* schemaTable, size_t cSchemas) | ||
{ | ||
size_t nSchema = 0; | ||
size_t nMatched = 0; | ||
size_t nUnmatched = 0; | ||
size_t initialOffset = cbDataMax; | ||
|
||
auto handler = [schemaTable, &nSchema, &nMatched, &nUnmatched](const ICorJitInfo::PgoInstrumentationSchema& schema) | ||
{ | ||
const size_t iSchemaAdj = nSchema - nUnmatched; | ||
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. Isn't this the same as 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. And thinking a little bit more about it, that means this might index off the end of 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. It is, yeah. |
||
|
||
if ((schema.InstrumentationKind != schemaTable[iSchemaAdj].InstrumentationKind) | ||
|| (schema.ILOffset != schemaTable[iSchemaAdj].ILOffset) | ||
|| (schema.Count != schemaTable[iSchemaAdj].Count) | ||
|| (schema.Other != schemaTable[iSchemaAdj].Other)) | ||
{ | ||
nUnmatched++; | ||
} | ||
else | ||
{ | ||
schemaTable[iSchemaAdj].Offset = schema.Offset; | ||
nMatched++; | ||
} | ||
|
||
nSchema++; | ||
|
||
return true; | ||
}; | ||
|
||
ReadInstrumentationSchemaWithLayout(pByte, cbDataMax, initialOffset, handler); | ||
|
||
return (nMatched == cSchemas); | ||
} | ||
|
||
inline bool ReadInstrumentationSchemaWithLayoutIntoSArray(const uint8_t *pByte, size_t cbDataMax, size_t initialOffset, SArray<ICorJitInfo::PgoInstrumentationSchema>* pSchemas) | ||
{ | ||
auto lambda = [pSchemas](const ICorJitInfo::PgoInstrumentationSchema &schema) | ||
|
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 was a little surprised that this mutates the schema. Maybe rename it to something like
SetOffsetsForSchemaSubsequence
or similar?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.
How about
CheckIfPgoSchemaIsCompatibleAndSetOffsets
?