Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiered jitting: StackTrace doesn't work correctly for tier1 methods #9672

Closed
noahfalk opened this issue Feb 6, 2018 · 0 comments
Closed
Assignees
Milestone

Comments

@noahfalk
Copy link
Member

noahfalk commented Feb 6, 2018

Repro:

  1. Write this code in a .Net Core app:
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;

namespace ConsoleApp8
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            CallMeAlot(true);
            for(int i = 0; i < 1000; i++)
            {
                CallMeAlot(false);
            }
            CallMeAlot(true);
            Console.ReadLine();
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        static void CallMeAlot(bool takeStackTrace)
        {
            Thread.Sleep(1);
            if(takeStackTrace)
            {
                Capture();
            }
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        static void Capture()
        {
            StackTrace trace = new StackTrace(true);
            Console.WriteLine(trace);
        }
    }
}
  1. Compile the app in retail configuration
  2. Run it on .Net Core with tiered compilation enabled (set COMPLUS_EXPERIMENTAL_TieredCompilation=1)

Expected output (what you get without tiered jitting):

Hello World!
at ConsoleApp8.Program.Capture() in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 32
at ConsoleApp8.Program.CallMeAlot(Boolean takeStackTrace) in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 26
at ConsoleApp8.Program.Main(String[] args) in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 12

at ConsoleApp8.Program.Capture() in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 32
at ConsoleApp8.Program.CallMeAlot(Boolean takeStackTrace) in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 26
at ConsoleApp8.Program.Main(String[] args) in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 17

Actual output (what you get with tiered jitting enabled):

Hello World!
at ConsoleApp8.Program.Capture() in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 32
at ConsoleApp8.Program.CallMeAlot(Boolean takeStackTrace) in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 26
at ConsoleApp8.Program.Main(String[] args) in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 12

at ConsoleApp8.Program.Capture() in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 32
at ConsoleApp8.Program.CallMeAlot(Boolean takeStackTrace)
at ConsoleApp8.Program.Main(String[] args) in c:\users\noahfalk\Source\Repos\ConsoleApp8\Program.cs:line 17

Other Notes:

This issue probably has the same underlying cause as #9642, but we fixed that issue with a very tailored fix that wasn't broad enough to activate in this scenario.

This issue is also related to #8296 - the work to resolve this issue is likely necessary but not sufficient to solve #8296. Tiered jitting only requires the native -> IL mapping information to work whereas profiler ReJIT has an additional IL -> IL mapping phase. #8296 requires fixing that additional IL->IL portion too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants