dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.95k stars 4.65k forks source link

Deoptimization returns different versions of code when R2R is used #92616

Closed mikelle-rogers closed 11 months ago

mikelle-rogers commented 11 months ago

Description

Stepping into a R2R method while debugging for the first time that does not result in a deoptimized method.

Reproduction Steps

using System.Runtime.CompilerServices;

class Program
{
    [MethodImpl(MethodImplOptions.AggressiveOptimization)]
    static void Main()
    {
        Console.Write(5);
        Console.Write(5);
    }
}

When using a release runtime, step in 4 times, then out 1, then in 2 times

Expected behavior

Should be in the WriteSpan method.

Actual behavior

Ends up in the Flush method instead of the WriteSpan method.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

ghost commented 11 months ago

Tagging subscribers to this area: @tommcdon See info in area-owners.md if you want to be subscribed.

Issue Details
### Description Stepping into a R2R method while debugging for the first time that does not result in a deoptimized method. ### Reproduction Steps ``` using System.Runtime.CompilerServices; class Program { [MethodImpl(MethodImplOptions.AggressiveOptimization)] static void Main() { Console.Write(5); Console.Write(5); } } ``` When using a release runtime, step in 4 times, then out 1, then in 2 times ### Expected behavior Should be in the `WriteSpan` method. ### Actual behavior Ends up in the `Flush` method instead of the `WriteSpan` method. ### Regression? _No response_ ### Known Workarounds _No response_ ### Configuration _No response_ ### Other information _No response_
Author: mikelle-rogers
Assignees: mikelle-rogers
Labels: `area-Diagnostics-coreclr`, `untriaged`, `needs-area-label`
Milestone: -
tommcdon commented 11 months ago

Fixed via https://github.com/dotnet/runtime/pull/92665