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
Intrinsify Interlocked.CompareExchange and Interlocked.Exchange for null #79181
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsCloses #69000 object Foo(ref object a)
=> Interlocked.Exchange(ref a, null);
object Foo(ref object a, object b)
=> Interlocked.CompareExchange(ref a, b, null);
} Was: ; Assembly listing for method Prog:Foo(byref):System.Object:this
488BCA mov rcx, rdx
33D2 xor rdx, rdx
E93616AC5F jmp Exchange(byref,System.Object):System.Object
; Total bytes of code 10
; Assembly listing for method Prog:Foo(byref,System.Object):System.Object:this
488BCA mov rcx, rdx
498BD0 mov rdx, r8
4533C0 xor r8, r8
E9A216AC5F jmp CompareExchange(byref,System.Object,System.Object):System.Object
; Total bytes of code 14 Now: ; Method Prog:Foo(byref):System.Object:this
33C0 xor rax, rax
488702 xchg gword ptr [rdx], rax
C3 ret
; Total bytes of code: 6
; Method Prog:Foo(byref,System.Object):System.Object:this
33C0 xor rax, rax
F0 lock
4C0FB102 cmpxchg gword ptr [rdx], r8
C3 ret
; Total bytes of code: 8
|
This needs write barrier for You can optimize |
src/coreclr/System.Private.CoreLib/src/System/Threading/Interlocked.CoreCLR.cs
Show resolved
Hide resolved
Thanks! Fixed, grep: https://grep.app/search?q=CompareExchange%5C%28ref%20%5Cw%2B%2C%20null%2C%20®exp=true |
/azp list |
This comment was marked as outdated.
This comment was marked as outdated.
/azp run runtime-coreclr outerloop, runtime-coreclr gcstress0x3-gcstress0xc, runtime-extra-platforms |
Azure Pipelines successfully started running 3 pipeline(s). |
@dotnet/jit-contrib PTAL, simple change |
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. Thanks!
Wow, quite a few improvements: dotnet/perf-autofiling-issues#10542 (e.g. Regex IsMatch as was expected by @GrabYourPitchforks in #69000 (comment)) |
@EgorBo, is it expected that IsMatch_Multithreading went from 56.73 ms to 0 ns? |
No. That's got to be a test harness / reporting issue, or else some kind of catastrophic failure :)
|
Closes #69000
Was:
Now: