- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.2k
 
Open
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 SuperPMI
Milestone
Description
Description
I'm working on improving BenchmarkDotNet's jit stage, and I ran into a strange issue. When I set env var DOTNET_TC_CallCountingDelayMs=0, the disassembly breaks. CanDisassembleAllMethodCalls fails with error:
Assert.Contains() Failure: Item not found in collection
Collection: ["ForDisassemblyDiagnoser()"]
Not found: "Benchmark(Int32)"
Reproduction Steps
[DisassemblyDiagnoser(maxDepth: 3)]
[Config(typeof(Config))]
public class IntroDisassemblyDry
{
    public class Config : ManualConfig
    {
        public Config()
        {
            AddColumnProvider(DefaultColumnProviders.Instance);
            AddLogger(ConsoleLogger.Default);
            AddJob(Job.Dry
                .WithEnvironmentVariable(new("DOTNET_TC_CallCountingDelayMs", "0"))
            );
        }
    }
    [Benchmark]
    public void Foo()
    {
    }
}Expected behavior
.NET 8.0.16 (8.0.16, 8.0.1625.21506), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
; BenchmarkDotNet.Samples.IntroDisassemblyDry.Foo()
       push      rbp
       mov       rbp,rsp
       mov       [rbp+10],rcx
       pop       rbp
       ret
; Total bytes of code 10Actual behavior
.NET 8.0.16 (8.0.16, 8.0.1625.21506), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
; BenchmarkDotNet.Autogenerated.Runnable_0.__ForDisassemblyDiagnoser__()
       push      rbp
       sub       rsp,20
       lea       rbp,[rsp+20]
       mov       [rbp+10],rcx
       mov       rcx,[rbp+10]
       cmp       dword ptr [rcx+38],0B
       jne       short M00_L00
       mov       rcx,[rbp+10]
       call      qword ptr [7FF8ED8AEB38]
M00_L00:
       nop
       add       rsp,20
       pop       rbp
       ret
; Total bytes of code 41Regression?
No response
Known Workarounds
No response
Configuration
BenchmarkDotNet v0.15.3-develop (2025-07-05), Windows 10 (10.0.19045.5965/22H2/2022Update)
AMD Ryzen 7 9800X3D 4.70GHz, 1 CPU, 16 logical and 8 physical cores
.NET SDK 10.0.100-preview.5.25277.114
  [Host] : .NET 8.0.16 (8.0.16, 8.0.1625.21506), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Dry    : .NET 8.0.16 (8.0.16, 8.0.1625.21506), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMII observe the same behavior in .Net 8 and .Net 10.
Other information
The code that should be jitted for the disassembler:
Is this a bug, or expected? Do we need to adjust how we're doing this?
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 SuperPMI