-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issuePerformance related issue
Milestone
Description
There is a small difference between code generated for direct reading of a volatile variable and doing it via Volatile.Read.
volatile int sharedVar;
public int Test()
{
return sharedVar;
}
public int Test2()
{
return Volatile.Read(ref sharedVar);
}
mov eax, dword ptr [rcx+8]
ret
;vs
cmp dword ptr [rcx], ecx
lea rax, bword ptr [rcx+8]
mov eax, dword ptr [rax]
ret
category:cq
theme:basic-cq
skill-level:expert
cost:large
GSPP and jamesqo
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issuePerformance related issue