-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[RyuJIT] Import String.Empty as CNS_STR #44847
Conversation
|
// Auto-generated message 69e114c which was merged 12/7 removed the intermediate src/coreclr/src/ folder. This PR needs to be updated as it touches files in that directory which causes conflicts. To update your commits you can use this bash script: https://gist.github.com/ViktorHofer/6d24f62abdcddb518b4966ead5ef3783. Feel free to use the comment section of the gist to improve the script for others. |
bb37777
to
32c449a
Compare
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 wonder if we should instead cache the value returned by emptyStringLiteral
on the jit side and recognize that in IsStringEmptyField()
?
Say add a gtNewEmptyStringLiteral
that sets the cache (or confirms the value if already set).
Then (I think) the changes in morph wouldn't be needed.
@AndyAyersMS Can you please re-review? I am now saving SconCPX to a global variable before |
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.
Would prefer not to have important mutable static state, so I'd suggest caching on the compiler instance.
Hm.. isn't compiler instance re-created (inited) for each method so caching on the instance level won't make any sense? |
Jit hosts may not always return the same value over the lifetime of a process, so caching the result in a static on the jit side won't work. But the value should be stable for a particular jit request. |
In particular, that may explain your SPMI and Crossgen2 failures... |
Will revise later, closing to keep amount of active PRs smaller. |
Fixes #42694
Jit-diff (
-f -pmi
):Diff is a regression because
GT_CNS_STR
(const) instead ofGT_IND
leads to bigger benefit multipliers.I decided to use a fake
SconCPX
(0) instead of a real one for "" because as far as I understand I'll have to add a new jit-API method to get one and I'm not sure it worth it.I'm planning to try to optimize
x == string.Empty
tox?.Length == 0
and it's better to haveGT_CNS_STR
there.