runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[ARM/Linux] Regression in JIT/Methodical/tailcall_v4/smallFrame/smallFrame.sh

Open hqueue opened this issue 10 years ago • 2 comments

JIT/Methodical/tailcall_v4/smallFrame/smallFrame.sh fails with recent version of coreclr in arm-softfp/Linux.

FAILED   - [002:   0s] JIT/Methodical/tailcall_v4/smallFrame/smallFrame.sh
               BEGIN EXECUTION
               /opt/media/microsd/dotnet/unittest/Windows_NT.x86.Release.160830/Tests/coreoverlay/corerun smallFrame.exe

               Unhandled Exception: System.InvalidProgramException: Common Language Runtime detected an invalid program.
                  at RetBufferBug.TailCaller()
                  at RetBufferBug.Main()
               crashed [1472803452] processname=corerun, pid=11352, tid=11352, signal=6./smallFrame.sh: line 117: 11352 Segmentation fault      $_DebuggerFullPath "$CORE_ROOT/corerun" smallFrame.exe $CLRTestExecutionArguments
               Expected: 100
               Actual: 139
               END EXECUTION - FAILED

hqueue avatar Sep 02 '16 08:09 hqueue

  • From f725c3a616b1e55db17b239b0256648fecd2356e, above test failure is observed in ARM32 with legacy backend.
  • Before f725c3a616b1e55db17b239b0256648fecd2356e,.tail prefix is ignored and RetBufferBug.TailCaller() was inlined to RetBufferBug.Main()
  • After f725c3a616b1e55db17b239b0256648fecd2356e, .tail prefix is honored and RetBufferBug.TailCaller() is not inlined anymore.

As a result, RetBufferBug.TailCaller()is being compiled seperately and RetBufferBug.TailCaller() is tested with Compiler::impIsTailCallILPattern() during JIT compilation. However this test fails, because only x64 support tail.call, pop, ret pattern in RetBufferBug.TailCaller(). (as in src/JIT/Methodical/tailcall_v4/smallFrame.il below)

.method private hidebysig static void TailCaller() cil managed
 {
 // Code size 7 (0x7)
 .maxstack 8
 //.line 114,114 : 3,16 ''
 IL_0000: tail. call valuetype RetBuff RetBufferBug::TailCallee()
 IL_0005: pop
 //.line 115,115 : 2,3 ''
 IL_0006: ret
 } // end of method RetBufferBug::TailCaller

This test was also discussed and excluded for x86 in issue dotnet/runtime#5698. I think this test should be also excluded from ARM32 for same reason since it's not supported.

I also tried to enable compiling above tailcall pattern for ARM32 by updating Compiler::impIsTailCallILPattern() to recognize above pattern for ARM32 and disable some assertion. It seems that it works, but I'm afraid only tail.call, ret is allowed in ECMA, and not tail.call, pop, ret.

cc: @LLITCHEV @RussKeldorph @erozenfeld @jkotas Is it ok to exclude above test for ARM32 lagacy backend ? And I'm also curious about supporting them for ARM32 later, because tail.call, pop, ret is not allowed in ECMA.(correct?)

hqueue avatar Sep 05 '16 12:09 hqueue

@hqueue Yes, this test should be excluded for ARM32 legacy backend. The sequence is not allowed per ECMA and is only supported on x64 for compatibility with legacy jit.

erozenfeld avatar Sep 06 '16 22:09 erozenfeld