Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RyuJIT: suboptimal code after inlining a method accessing a field via ref #4363

@omariom

Description

@omariom

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

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions