Repository navigation
Add "points to stack" tree flag for GT_ADDR. - #48675
Closed
sandreenko wants to merge 9 commits into
Closed
sandreenko wants to merge 9 commits into
sandreenko wants to merge 9 commits into
Conversation
added 8 commits
February 23, 2021 09:52
Member
Contributor
Author
|
thanks Andy! |
Contributor
Author
|
closing as not 6.0 item. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
In #48308 (comment) we noticed that we are not consistent about our ADDR optimizations, long story short we don't need to emit a full write barrier when we change a byref that points to the stack, the current Jit does it by retyping
TYP_BYREFtoTYP_I_IMPLin some cases, however, other places are not aware of it and can generate worse code, asserts or bad code because of that.I was trying to make it consistent and convert all such addresses to
I_IMPLand then assert during check and rationalize, however, it did not work well, because:addrModethat can't useop2withLCL_VAR_ADDRbut it detects them bybyreftype, if it isIMPLwe don't correctly update the liveness for it;lvaGrabTemp(true DEBUGARG("Cast away GC"))but does not catch all necessary cases.LclVar V01 byref = LclVar V02 long;These changes are in the first 5 commits.
so mostly because of the asserts I've decided to try to keep them as
BYREFand use a tree flag on such addresses:0771c2e: use a flag instead of IMPL type.
it passed stress tests (revealed one with incorrect IL, was fixed), gave some improvements but overall regression.
cbc2de7: Fix regressions1.
Fix regressions when we had something like
IND short(cast short(ADDR byref ()).c8b8a4d: Fix regressions2.
Teach
DefinesLocal,impIsAddressInLocalandIsLocalExprto skip cast nodes.Even with these fixes, the overall score is still a regression, mostly because of the new
DEBUGARG("Cast away GC"))temps.However, at least this change c723b6e#diff-d593fa9f647288fed0e0a54655a5d55586fab17368fe5212df2604a48d5a064dL644 looks like a correctness fix. This code is working because in most cases
I_IMPLis used for stack addresses but it could be used for anything via a cast, it this case we will get a hole.I want to gather @dotnet/jit-contrib optinions:
Byrefwith a flag because of the existing logic that is checkingType == BYREFand assertion/copy prop;lvaGrabTemp(true DEBUGARG("Cast away GC"))temps and support such implicit casts in emitter? How do we want to representCAST I_IMPL<-byrefin different phases?DefinesLocal,impIsAddressInLocalandIsLocalExpr? Is something preventing us from merging them?Diffs (spmi x64):