-
Notifications
You must be signed in to change notification settings - Fork 5k
JIT: Extend escape analysis to account for arrays with non-gcref elements #104906
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
+766
−123
Merged
Changes from all commits
Commits
Show all changes
97 commits
Select commit
Hold shift + click to select a range
1b0e3d3
initial prototype
hez2010 57b7e42
Morph ARR_LENGTH and INDEX_ADDR
hez2010 1b5b25e
Fix incorrect array length storage
hez2010 395b735
Use offset and correct type
hez2010 17de70b
handle reassignment
hez2010 5443c42
range check
hez2010 b2d07da
throw range check failure
hez2010 b5ae9e7
update comments
hez2010 87b29de
add metrics
hez2010 eeb681d
minor cleanup
hez2010 dee9f38
Introduce new temp and implement local address morphing
hez2010 94c103b
handle index out-of-range
hez2010 12b297b
Refactor to remove duplicates
hez2010 e0fa91e
Remove invalid asserts
hez2010 9e0a04f
make compiler happy
hez2010 ae822f8
Address review feedbacks
hez2010 a4588bb
Fix INDEX_ADDR and add Sub
hez2010 32b9e26
Support IsAddressLessThan and its friends
hez2010 39d1ad9
Fix assertions
hez2010 0df0d58
Merge remote-tracking branch 'origin/main' into value-array-stack-alloc
hez2010 9f408b2
Use new overload
hez2010 418a62b
JIT: Remove GTF_IND_INVARIANT and GTF_IND_NONFAULTING flags checking
jakobbotsch 4572408
Remove old comment
jakobbotsch 9255762
Expose jitconfig
hez2010 1af84b9
Remove another assert
jakobbotsch 629c793
Count
jakobbotsch b578203
Try 2 at counting
jakobbotsch b4445f6
Introduce BBF_HAS_NEWARR
hez2010 af9c40e
Early exit on debug as well
hez2010 8b54f5a
Update computed flags
hez2010 cba4d2c
Merge remote-tracking branch 'jakobbotsch/indir-flags' into value-arr…
hez2010 b497fae
Merge remote-tracking branch 'origin/main' into value-array-stack-alloc
hez2010 6eca58d
Partially revert 39d1ad9
hez2010 49d8509
Reuse existing comma node
hez2010 4c6e359
Respect IsBoundsChecked
hez2010 4d84379
Check lowerbound too
hez2010 c0cad85
Fix assertion take 2
hez2010 d28553a
Remove redundant jit-ee calls
hez2010 f42e78f
Merge branch 'main' into value-array-stack-alloc
hez2010 c21c4f7
Fix assertion again
hez2010 18ec558
Check array length
hez2010 eadb4ad
Fix assertion in another way
hez2010 9d4021c
Unset the flag to avoid unnecessary assert
hez2010 1cba8c0
Merge branch 'main' into value-array-stack-alloc
hez2010 1fff53e
Add tests
hez2010 d521a94
sigh
hez2010 97ee2be
Support R2R/NativeAOT
hez2010 c66bdb8
Merge branch 'main' into value-array-stack-alloc
hez2010 5bcb786
Fix building
hez2010 a01562e
cleanup
hez2010 e728d4f
remove invalid assert
hez2010 d73c5c5
double align on 32bit platform
hez2010 c9fea23
Use correct alignment for align8
hez2010 772bee6
Fix intrinsic expansion
hez2010 499ac0b
Merge branch 'main' into value-array-stack-alloc
hez2010 ffcbd85
Merge remote-tracking branch 'origin/main' into value-array-stack-alloc
hez2010 4789090
Merge branch 'main' into value-array-stack-alloc
hez2010 1b33170
Merge branch 'main' into value-array-stack-alloc
hez2010 9c81c04
Address some review feedback
hez2010 ed6c83c
Merge branch 'main' into value-array-stack-alloc
hez2010 6a7e6cb
Revert workaround to fgMorphSmpOp
hez2010 e4d91ed
Merge branch 'main' into value-array-stack-alloc
hez2010 aeeb9e3
Fix build failure
hez2010 0e2a01d
Merge branch 'main' into value-array-stack-alloc
hez2010 1914e80
Try fixing remorph issue
hez2010 f671085
Minimize asmdiff for tier-0
hez2010 d4fd6ae
Check CI
hez2010 b3ff72d
Take INDEX as non-escape
hez2010 49c39b9
Early exit when optimization is disabled
hez2010 a696f87
Format
hez2010 ce2de99
Merge branch 'main' into value-array-stack-alloc
hez2010 cc88979
Revert "Try fixing remorph issue"
hez2010 8d38e0c
Merge branch 'main' into value-array-stack-alloc
AndyAyersMS 52b32f2
Introduce a flag for stack allocated arrays
hez2010 1f342bd
Handle in global morph
hez2010 5b51919
Some special cases
hez2010 ce41a8d
Avoid extensive remorph
hez2010 47114c6
Oops
hez2010 66e98cd
Merge branch 'main' into value-array-stack-alloc
AndyAyersMS de30bdc
Alternative take on array stack allocation
AndyAyersMS 5137a5c
basic VN support
AndyAyersMS 315f884
Merge branch 'main' into value-array-stack-alloc
AndyAyersMS aa09187
restore complexity change
AndyAyersMS c451435
pass address of stack local to new helper
AndyAyersMS 18d3677
Merge branch 'main' into value-array-stack-alloc-alt
AndyAyersMS f6b012a
temp hack to boost SPMI coverage
AndyAyersMS a6e7bd5
avoid pessimizing tail calls. implement configurable size limit
AndyAyersMS b3edc07
add missing well known arg string
AndyAyersMS 9b63e2d
fix array length check
AndyAyersMS e535657
use ClrSafeInt directly
AndyAyersMS 07cd310
bypass for R2R for now, since it may inhibit prejitting
AndyAyersMS 2e2bdf6
Merge branch 'main' into value-array-stack-alloc
AndyAyersMS 7f95162
Merge remote-tracking branch 'hez/value-array-stack-alloc' into value…
AndyAyersMS 1915450
Merge branch 'main' into value-array-stack-alloc
hez2010 210f009
Merge branch 'main' into value-array-stack-alloc
AndyAyersMS 71ebf24
revise helper expansion
AndyAyersMS 97eba58
revise remainder
AndyAyersMS 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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3586,7 +3586,7 @@ class SsaNumInfo final | |
} | ||
}; | ||
|
||
// Common supertype of [STORE_]LCL_VAR, [STORE_]LCL_FLD, PHI_ARG, LCL_VAR_ADDR, LCL_FLD_ADDR. | ||
// Common supertype of [STORE_]LCL_VAR, [STORE_]LCL_FLD, PHI_ARG, LCL_ADDR. | ||
// This inherits from UnOp because lclvar stores are unary. | ||
// | ||
struct GenTreeLclVarCommon : public GenTreeUnOp | ||
|
@@ -4227,6 +4227,7 @@ enum GenTreeCallFlags : unsigned int | |
GTF_CALL_M_CAST_CAN_BE_EXPANDED = 0x04000000, // this cast (helper call) can be expanded if it's profitable. To be removed. | ||
GTF_CALL_M_CAST_OBJ_NONNULL = 0x08000000, // if we expand this specific cast we don't need to check the input object for null | ||
// NOTE: if needed, this flag can be removed, and we can introduce new _NONNUL cast helpers | ||
GTF_CALL_M_STACK_ARRAY = 0x10000000, // this call is a new array helper for a stack allocated array. | ||
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. I suppose we weren't able to get rid of this since it's also used in VN. |
||
}; | ||
|
||
inline constexpr GenTreeCallFlags operator ~(GenTreeCallFlags a) | ||
|
@@ -4566,6 +4567,7 @@ enum class WellKnownArg : unsigned | |
SwiftError, | ||
SwiftSelf, | ||
X86TailCallSpecialArg, | ||
StackArrayLocal, | ||
}; | ||
|
||
#ifdef DEBUG | ||
|
@@ -7586,12 +7588,12 @@ struct GenTreeArrAddr : GenTreeUnOp | |
|
||
public: | ||
GenTreeArrAddr(GenTree* addr, var_types elemType, CORINFO_CLASS_HANDLE elemClassHandle, uint8_t firstElemOffset) | ||
: GenTreeUnOp(GT_ARR_ADDR, TYP_BYREF, addr DEBUGARG(/* largeNode */ false)) | ||
: GenTreeUnOp(GT_ARR_ADDR, addr->TypeGet(), addr DEBUGARG(/* largeNode */ false)) | ||
, m_elemClassHandle(elemClassHandle) | ||
, m_elemType(elemType) | ||
, m_firstElemOffset(firstElemOffset) | ||
{ | ||
assert(addr->TypeIs(TYP_BYREF)); | ||
assert(addr->TypeIs(TYP_BYREF, TYP_I_IMPL)); | ||
assert(((elemType == TYP_STRUCT) && (elemClassHandle != NO_CLASS_HANDLE)) || | ||
hez2010 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
(elemClassHandle == NO_CLASS_HANDLE)); | ||
} | ||
|
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.