-
Notifications
You must be signed in to change notification settings - Fork 5.2k
JIT: relax fwd sub restriction on changing class handle #70587
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does this mean that if we have a
TYP_SIMD16
without a handle (such as because its a purely synthesized node) we can't substitute?Uh oh!
There was an error while loading. Please reload this page.
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. Happy to just broaden this and check for simd type, rather than class handles, if that's correct.
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'm not aware of anything that would impact this. We have logic for eliding
AsVector4
andAsVector128
in import. Same forVector<T>
<->Vector128
orVector256
(which ever matches the size ofVector<T>
)This can basically be summed as:
TYP_SIMD8
can be subbed for anotherTYP_SIMD8
TYP_SIMD12
can be subbed for anotherTYP_SIMD12
TYP_SIMD16
can be subbed for anotherTYP_SIMD16
TYP_SIMD32
can be subbed for anotherTYP_SIMD32
If the
varType
doesn't match up, then substitution is invalid.I would generally expect we could do something like this
Where for "well known types", we can just bypass the handle check entirely since they are primitives or SIMD. But for unknown struct types and other special scenarios, we need to do a handle check.
I'm unsure if integers are a problem for certain cases like where
TYP_UINT
is tracked on the stack as aTYP_INT
.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.
Of course, this is assuming there aren't any "gotchas" like @SingleAccretion was mentioning above.
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.
As below and above, the call arguments issue prevents us from being permissive here. We cannot lose precise handles for them if they're
varTypeIsStruct
.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.
That sounds dangerous/complicated. I wouldn't expect something like
struct { byte x; }
to be subtitutable with say astruct { int x; }
.I'm guessing there is something I'm missing here...
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, we could restrict this pessimization to calls/multi-reg returns only.
Yes.
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.
If you look at forward sub this handle check is just one of many cases where it won't substitute even if it should be legal and profitable (and likewise the legality and profitability analyses themselves can be improved).
Would be great if we could chip away at all these. I likely won't have much time to do this anytime soon.
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.
The ultimate goal is to make
ClassLayout::AreCompatible
the "type identity" for structs, and that would only allow same-sized structs.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.
Right, yes, "mismatching class handles" was a bit too liberally phrased.