Skip to content

JIT produces different asm from IL emit than from source #89685

Open
@timcassell

Description

@timcassell

While refactoring BenchmarkDotNet to call benchmark methods directly instead of through a delegate (dotnet/BenchmarkDotNet#2334), I ran into an issue where the InProcessEmitToolchain is producing different results than the default toolchain. I disassembled it to try to figure out why it was different, and found the only difference is the call instruction.

Default toolchain

call      qword ptr [BenchmarkDotNet.Autogenerated.Runnable_0.__Overhead()]

InProcessEmit

call      BenchmarkDotNet.Autogenerated.Runnable_0.__Overhead()

It wouldn't really be an issue if the workload call also used the same call instruction, but it doesn't, so the overhead measurement is off.

call      qword ptr [ActualWork.IncrementField()]

Is there any way I can make the asm match so we can get correct measurements?

call-direct-default-asm.md
call-direct-inprocess-asm.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions