-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
JIT: Physical promotion readback mechanism does not take implicit control flow into account #86498
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsPhysical promotion currently relies on being able to insert pending read backs before control flow is transferred to any successor block. This happens at the end of the block, but doing it this way does not take implicit control flow into account. For example: using System;
using System.Runtime.CompilerServices;
public class Program
{
public static int Main()
{
int result = Test();
if (result == 100)
{
Console.WriteLine("PASS");
}
else
{
Console.WriteLine("FAIL: Returned {0}", result);
}
return result;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static int Test()
{
Foo f = new();
try
{
f.X = 15;
f.Y = 20;
f.X += f.Y;
f.Y *= f.X;
// f will be physically promoted and will require a read back after this call.
// However, there is implicit control flow happening that the read back should happen before.
f = Call(f);
ThrowException();
return -1;
}
catch (Exception ex)
{
return f.X + f.Y;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static Foo Call(Foo f)
{
return new Foo { X = 75, Y = 25 };
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void ThrowException()
{
throw new Exception();
}
private struct Foo
{
public short X, Y;
}
} To fix we can likely insert any pending read backs before any
|
Physical promotion relies on being able to read back any promoted field that is fresher in its struct local before control flows to any successor block. This was failing to take implicit control flow into account. Fix dotnet#86498
Physical promotion currently relies on being able to insert pending read backs before control is transferred to any successor block. This happens at the end of the block, but doing it this way does not take implicit control flow into account. For example:
To fix we can likely insert any pending read backs before any
GTF_EXCEPT
marked tree when in a try region.The text was updated successfully, but these errors were encountered: