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.
Should this rather be fixed on the EE side of the JIT/EE interface?
JIT cases should return the actual page size, AOT should return the minimum conservative size.
Otherwise, what's the point of having the osPageSize provided by the JIT/EE interface?
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.
Actually, I was planning to remove the
eeGetPageSizeand replace the current usages with a constant.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 you also plan to delete
osPageSizefrom JIT/EE interface? If yes, sounds good to me to keep things simple.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 don't see any other usages of the
osPageSizefield inCORINFO_EE_INFOfrom the JIT side other than for making stack probing decisions. If we make the JIT always use the minimum conservative size0x1000for both AOT and JIT scenarios then there is no purpose of having the field and functioneeGetPageSize.What approach do you think would be better?
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, the reason I submitted the change as is to have it identical with backport change in #45226 and follow up on the cleanup at a later point.
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.
This is tradeoff between simplicity and performance. If the actual page size is larger, you can save cycles for methods with 4k+ frames if you use the actual page size to JIT vs. the conservative minimum.
How often do we see methods with 4k+ frames?
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.
My gut feel is that we tend to optimize even more corner-case scenarios that this one, so it suggests that this bit of extra complexity may meet the bar.
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 would agree with that for 6.0. For 5.0 servicing simpler is better.
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.
When I did #44664 I recall seeing no more than 10 methods with code differences (where the JIT replaced the inlined stack probing with a call to stack probe helper), so I would guess not many in dotnet/runtime. However, let me re-collect such statistics again to have all the number on hands.
If we go with that approach, do you think it would be worth to go one step further and have multiple implementations of stack probe helpers for different page sizes (EE would specify what JIT helper to use at the process start time). For example, Arm64 we could have three implementations - for
PAGE_SIZEthat is0x1000,0x4000,0x10000bytes.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 do not think it is worth going this far. I think the most significant difference is between needing to call the helper vs. not needing to call the helper.