Disable JIT_TailCall invocation on Unix
authorJan Vorlicek <janvorli@microsoft.com>
Tue, 14 Apr 2015 11:32:51 +0000 (13:32 +0200)
committerJan Vorlicek <janvorli@microsoft.com>
Tue, 14 Apr 2015 15:28:10 +0000 (17:28 +0200)
This change prevents jitter from performing tail calls in case the tail call
would require a tailcall helper.
The reason is that we don't have the JIT_TailCall function implemented for Unix
and even if we did, the underlying function to copy the arguments, the
StubLinkerCPU::CreateTailCallCopyArgsThunk, would be difficult to port to Unix due
to the fact that it assumes that va_list is represented as the parameters
being placed in memory one after another while on Unix, it is an opaque structure.
Jan Kotas has recommended to disable this kind of tail calls on Unix and
create a work item to refactor the way these tail calls are implemented.
Besides these Unix specific issues, the current implementation has performance
and maintainability issues, according to Jan Kotas.

src/jit/morph.cpp

index 7f5ca56..37ca4b1 100644 (file)
@@ -5646,7 +5646,11 @@ GenTreePtr          Compiler::fgMorphCall(GenTreeCall* call)
         // fast calls.
         if (!canFastTailCall)
         {
+#ifndef FEATURE_PAL
             fgMorphTailCall(call);
+#else // FEATURE_PAL
+            goto NO_TAIL_CALL;
+#endif // FEATURE_PAL
         }
 
         // Implementation note : If we optimize tailcall to do a direct jump