-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Remove pinning from frozen objects (strings, arrays, ..) #117340
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
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
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.
Pull Request Overview
This PR refines JIT handling of pinned and non-GC objects by:
- Peeling through certain
VNF_Castnodes when computing constant offsets. - Ignoring
ldargaon constant string nodes during inline argument substitution. - Extending
GenTree::IsNotGcDef()to treat NonGC objects (and simple offset patterns) as non-GC definitions.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/jit/valuenum.cpp | Allow VNF_Cast (GC→I) to be peeled out when computing offsets |
| src/coreclr/jit/importer.cpp | Refine argCanBeModified to skip ldarga on GT_CNS_STR |
| src/coreclr/jit/gentree.h | Enhance IsNotGcDef() to recognize NonGC object handles and GT_ADD offsets |
Comments suppressed due to low confidence (2)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
PTAL @jakobbotsch @dotnet/jit-contrib |
Ignore pinning on top of NonGC objects (string literals, static readonly arrays, etc.).
codegen diff:
; Method Program:Test():this (FullOpts) sub rsp, 40 - mov rcx, 0x274803D568C - mov bword ptr [rsp+0x20], rcx - mov rcx, bword ptr [rsp+0x20] - movzx rcx, word ptr [rcx+0x04] + mov ecx, 115 ;; 's' call [System.Console:WriteLine(char)] + nop - xor eax, eax - mov bword ptr [rsp+0x20], rax add rsp, 40 ret -; Total bytes of code: 46 +; Total bytes of code: 21spmi diffs