-
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
JIT: Mark certain intrinsics as non-escaping #113093
Conversation
@AndyAyersMS so after GetBytes is inlined, we get:
JIT IR before 'Allocate Objects' phase:
Looks like saving array object into Span._reference is preventing us from optimizing it |
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
As I mentioned in chat, I can split off the part of #112543 that deals with local span captures from the part that tries to reason about what happens when spans get passed to calls. |
@AndyAyersMS Nice! Should we land this PR then? It seems to find some diffs alone too, but it definitely need your work to properly handle more cases |
Yeah go ahead, I will try and get the other thing going but it may be a day or two. |
@@ -1139,6 +1139,25 @@ bool ObjectAllocator::CanLclVarEscapeViaParentStack(ArrayStack<GenTree*>* parent | |||
canLclVarEscapeViaParentStack = | |||
!Compiler::s_helperCallProperties.IsNoEscape(comp->eeGetHelperNum(asCall->gtCallMethHnd)); | |||
} | |||
else if (asCall->IsSpecialIntrinsic()) | |||
{ | |||
// Some known special intrinsics don't escape. At this moment, only the ones accepting byrefs |
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.
byrefs for non-GC types....
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'll add that to the comment as part of a different PR to avoid re-running CI 🙂
The goal is to support things like
where we want to save n-bytes of a primitive into a span, today we can either use either ^ (allocates) or come up with something ugly/unsafe.
But looks like there more work to do in JIT to enable that. Currently, JIT gives up on saving the temp array into Span.