[ARM/Linux] Revisiting FEATURE_FASTTAILCALL issues
I'm revisiting FEATURE_FASTTAILCALL issues in Linux/ARM and Liunx/ARM_SOFTFP.
It seems that three unit tests fails due to lack of FEATURE_FASTTAILCALL in ARM legacy backend.
- JIT/Directed/tailcall/tailcall
- JIT/Methodical/tailcall_v4/hijacking
- JIT/Regression/JitBlue/devdiv_902271/DevDiv_902271
There are two opened issues related to FEATURE_FASTTAILCALL in ARM/Linux, i.e. dotnet/runtime#5969 and dotnet/runtime#5722. As already discussed in two issues, we can (1) skip those tests or (2) try to enable FEATURE_FASTTAILCALL in legacy ARM codegen.
DevDiv_902271 was being discussed to be exclued when COMPlus_JitStress=2, becuase tail call optimziation is turned off in JitStress=2 (issue dotnet/runtime#4793). So if enabling FASTTAILCALL is not feasible, there is no problem disabling these tests from Linux/ARM for now.
Both two target architecture using legacy backend, i.e. x86 and arm, are lack of FEATURE_FASTTAILCALL.
In src/jit/target.h,
#define FEATURE_FASTTAILCALL 0 // _TARGET_X86_
#define FEATURE_FASTTAILCALL 1 // _TARGET_AMD64_
#define FEATURE_FASTTAILCALL 0 // _TARGET_ARM_
#define FEATURE_FASTTAILCALL 1 // _TARGET_ARM64_
For ARM64, FEATURE_FASTTAILCALL has been enabled about two months ago with PR dotnet/coreclr#4791.
Therefore I'm now looking into ARM legacy codegen whether it is possible to enable FEATURER_FASTTAILCALL with similar way to PR dotnet/coreclr#4791, but it take some time because there are lots of difference between ryujit backend and legacy backend.
@myungjoo @chunseoklee @leemgs @parjong @wateret @jyoungyun @lemmaa @hongsekim Let me know if there are more unix test failure in ARM/Linux related to FEATURE_FASTTAILCALL.
@kyulee1 What do you think of enabling FEATURE_FASTTAILCALL for ARM legacy backend ? Looking for an advice.
adding @sivarv @dotnet/jit-contrib Any comment for enabling tail call for arm?
Legacy Arm 32 back-end doesn't support fast tail calls and supports only helper based tail calls. Helper based tail calls are used for dispatching ".tail" prefixed calls. Adding fast tail call support would require work in fgMorphTailCall(), fgCanFastTailCall(), in genCodeForCall(), genFnEpilog() and possibly in VM. It would be a non-trivial amount of work.
If there are any tests that are failing because they depend on fast tail call optimization, i would suggest to disable them for Arm32. It could be those tests got ported as part of Amd64 Jit test porting.
@sivarv Thank you for comprehsnsive explanation :) I will check those functions you mentioned and will consider disabling failing tests for Arm32.
We are tracking fast tail call work in https://github.com/dotnet/coreclr/issues/13828. I will close this issue now.