-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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: Use faster unchecked write-barrier for boxed statics #98166
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue Details
Example: struct MyStruct
{
public object Obj;
}
static MyStruct boxedStatic;
[MethodImpl(MethodImplOptions.NoInlining)]
static void Test(string str1, string str2)
{
boxedStatic.Obj = str1;
boxedStatic.Obj = str2;
}Codegen diff for ; Method Prog:Test(System.String,System.String) (FullOpts)
G_M57713_IG01:
push rdi
push rsi
push rbx
sub rsp, 32
mov rbx, rcx
mov rsi, rdx
G_M57713_IG02:
test byte ptr [(reloc 0x7ff8e243b942)], 1 ; global ptr
je SHORT G_M57713_IG05
G_M57713_IG03:
mov rcx, 0x21A0D401E10 ; box for Prog:boxedStatic
mov rdi, gword ptr [rcx]
add rdi, 8
mov rcx, rdi
mov rdx, rbx
- call CORINFO_HELP_CHECKED_ASSIGN_REF
+ call CORINFO_HELP_ASSIGN_REF
mov rcx, rdi
mov rdx, rsi
- call CORINFO_HELP_CHECKED_ASSIGN_REF
+ call CORINFO_HELP_ASSIGN_REF
nop
G_M57713_IG04:
add rsp, 32
pop rbx
pop rsi
pop rdi
ret
G_M57713_IG05:
mov rcx, 0x7FF8E243B910
mov edx, 2
call CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE
jmp SHORT G_M57713_IG03
; Total bytes of code: 92
|
|
@AndyAyersMS @kunalspathak (cc @dotnet/jit-contrib) a quick follow up to my previous PR There are only a few text diffs after marking boxed static address as unchecked barrier + a small clean up. |
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.
LGTM

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

And a small clean up.
Example:
Codegen diff for
Test:; Method Prog:Test(System.String,System.String) (FullOpts) G_M57713_IG01: push rdi push rsi push rbx sub rsp, 32 mov rbx, rcx mov rsi, rdx G_M57713_IG02: test byte ptr [(reloc 0x7ff8e243b942)], 1 ; global ptr je SHORT G_M57713_IG05 G_M57713_IG03: mov rcx, 0x21A0D401E10 ; box for Prog:boxedStatic mov rdi, gword ptr [rcx] add rdi, 8 mov rcx, rdi mov rdx, rbx - call CORINFO_HELP_CHECKED_ASSIGN_REF + call CORINFO_HELP_ASSIGN_REF mov rcx, rdi mov rdx, rsi - call CORINFO_HELP_CHECKED_ASSIGN_REF + call CORINFO_HELP_ASSIGN_REF nop G_M57713_IG04: add rsp, 32 pop rbx pop rsi pop rdi ret G_M57713_IG05: mov rcx, 0x7FF8E243B910 mov edx, 2 call CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE jmp SHORT G_M57713_IG03 ; Total bytes of code: 92