-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 codegen for ARM32 produces incorrect behaviour #45250
Comments
Without the arm32 device, we can also use Debian arm32 docker: $ dotnet build && dotnet build -c Release
$ tar czf repro.tar.gz bin/
$ docker run mcr.microsoft.com/dotnet-buildtools/prereqs:debian-9-arm32v7-20200918130550-bfcd90a
$ docker cp repro.tar.gz $(docker ps --format '{{.ID}}' | head -1):/
$ docker exec $(docker ps --format '{{.ID}}' | head -1) sh
# inside docker shell
$ mkdir myrepro
$ tar xzf repro.tar.gz -C myrepro
$ mkdir ~/.dotnet
$ curl -sSL https://aka.ms/dotnet/net5/5.0.1xx/daily/Sdk/dotnet-sdk-linux-arm.tar.gz | tar xzf - -C ~/.dotnet
$ ~/.dotnet/dotnet myrepro/bin/Release/net5.0/repro.dll
u_tyar_constraints - entry
u_tyar_constraints - exit
u_list_revi - enter
u_tyar_constraint: 1
u_tyar_constraint: 2
u_list_revi - exit (same result with |
Investigating. |
I suspected that the issue was some sort of weird interaction between tail call via helper and generics, so I talked to @erozenfeld who was working in this area in the past. He suggested disabling fast tail call optimization on x64 (we don't have the optimization on arm32) and see if the issue reproduces on that platform. It does and that should make the debugging quite easier:
|
I constructed a simpler repro that does not require F# in #45527. Presumably the test should fail on any platform that supports tail call via helpers The issue origin is how the JIT transforms
The IL snippet corresponds to the following C# code (with small modification of adding static void Run(FuncGetter funcGetter)
{
funcGetter.Get<string>().Run();
} In
would be transformed into a call to dispatcher and an IL stub:
A target of such tail call would be transformed to a helper call The same happened in the reported F# program where The fix to the issue should be spilling Working on the fix. cc @dotnet/jit-contrib |
* Add regression test for #45250 * Add VirtCallThisHasSideEffects to more_tailcalls.cs and update more_tailcalls.il * Spill "this" if needed to avoid evaluating it twice when "this" is used to compute the target function pointer in morph.cpp
Reopen and change milestone to 5.0 to track backporting of #45527 |
Nice ... thanks |
Closed with #45880 in 5.0 |
We have an issue with the F# compiler on ARM32: dotnet/fsharp#10454
Title: F# 5.0.100 sdk broken for Linux Arm32 build #10454
I have a much smaller of the issue.
Compile the project and run it on windows:
Observe the output:
run the binary
observe the output:
Note that u_tyar_constraint: is invoked twice on the arm and once on Windows.
The text was updated successfully, but these errors were encountered: