-
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
Write barrier elision on object reference assignment to a return buffer? #92662
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsDescriptionConsider the method On G_M000_IG01: ;; offset=0x0000
push rdi
push rsi
push rbx
sub rsp, 32
mov rbx, rcx
G_M000_IG02: ;; offset=0x000A
mov rsi, 0x7FFCD3835FA0
mov rcx, rsi
call CORINFO_HELP_NEWSFAST
mov rdi, rax
mov rcx, rsi
call CORINFO_HELP_NEWSFAST
mov rsi, rax
mov rdx, rdi
mov rcx, rbx
call CORINFO_HELP_CHECKED_ASSIGN_REF
lea rcx, bword ptr [rbx+0x08]
mov rdx, rsi
call CORINFO_HELP_CHECKED_ASSIGN_REF
mov rax, rbx
G_M000_IG03: ;; offset=0x0044
add rsp, 32
pop rbx
pop rsi
pop rdi
ret
; Total bytes of code: 76 Are write barriers necessary given the fact that it is known that object references are being assigned to a return buffer which should not require write barriers? Is there something I am missing? Configuration
|
They are necessary because the JIT can optimize passed return buffers to point to heap. For example, check the codegen for something like |
Today I learned, thanks! |
Description
Consider the method
static (object, object) GetObj() => (new(), new());
.On
win-x64
JIT emits the following codegen for it:Are write barriers necessary given the fact that it is known that object references are being assigned to a return buffer? Is there something I am missing?
Configuration
The text was updated successfully, but these errors were encountered: