-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Track single def locals in importer #21251
Track single def locals in importer #21251
Conversation
Since this information isn't used early on in the jit, defer setting this bit until later. (a subsequent change will repurpose this bit and use it early too).
And use this information to enable type updates during late devirtualization. This gets some cases where the exact type materializes late (perhaps via a chain of copies).
@briansull PTAL Diffs from second commit, mainly more devirtualization:
|
#endif | ||
|
||
varDsc->lvIsPtr = 1; | ||
varDsc->lvIsPtr = 1; |
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.
Do we still have varDsc->lvSingleDef here?
It is important to mark the 'this' pointer as a single def variable.
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.
it is set later on (as you note below).
|
||
// Set initial value for lvSingleDef for explicit and implicit | ||
// argument locals as they are "defined" on entry. | ||
varDsc->lvSingleDef = varDsc->lvIsParam; |
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.
Is this where we get the 'this' pointers lcSingleDef set to true?
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.
Yes.
You may be able to close Issue #17949 after this change. |
if (!varDsc->lvClassIsExact && isNewClass) | ||
{ | ||
// Todo: improve this analysis by adding a new jit interface method | ||
DWORD newAttrs = info.compCompHnd->getClassAttribs(clsHnd); |
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.
Computing class attribs is relatively expensive operation. It computes a ton more than just the CORINFO_FLG_SHAREDINST
flag that you care about here. It would be better to change mergeClasses
to return NULL when any of the types is shared.
Sure. These type updates shouldn't happen all that often but moving the check should be simpler and faster. |
* Defer setting lvSingleDef until lvaMarkLocalVars Since this information isn't used early on in the jit, defer setting this bit until later. * Track single-def locals in the importer and use this information to enable type updates during late devirtualization. This gets some cases where the exact type materializes late (perhaps via a chain of copies). Commit migrated from dotnet/coreclr@40bf810
Two separate commits (currently).
First just refactors existing use of
lvSingleDef
and is no diff.Second repurposes
lvSingleDef
early to keep track of locals that are amenable to type updates, and then adds some type propagation to the late devirtualization callback.