[ARM32/RyuJIT] Compilation (crossgen) fail for call instruction
When I tried to crossgen - readytorun
command: export COMPlus_AltJitNgen=* ./crossgen /ReadyToRun /Platform_Assemblies_paths ./ ./System.Private.CoreLib.dll
Assert failure(PID 2432 [0x00000980], Thread: 2432 [0x0980]): (value != 0) && ((value & (value-1)) == 0)
File: /nfs/rbp3/coreclr/src/inc/bitposition.h Line: 27
Image:
Aborted (core dumped)
backtrace
#0 __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
dotnet/coreclr#1 0x76c4f648 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
dotnet/coreclr#2 0x76c5034a in __GI_abort () at abort.c:89
dotnet/coreclr#3 0x75851c8c in PROCEndProcess (hProcess=0xffffff01, uExitCode=123456789, bTerminateUnconditionally=1) at /nfs/rbp3/coreclr/src/pal/src/thread/process.cpp:1385
dotnet/coreclr#4 0x75851dca in TerminateProcess (hProcess=0xffffff01, uExitCode=123456789) at /nfs/rbp3/coreclr/src/pal/src/thread/process.cpp:1301
dotnet/coreclr#5 0x75790bf6 in TerminateOnAssert () at /nfs/rbp3/coreclr/src/utilcode/debug.cpp:183
dotnet/coreclr#6 0x7579142e in _DbgBreakCheck (szFile=0x7587e076 "/nfs/rbp3/coreclr/src/inc/bitposition.h", iLine=27, szExpr=0x7587e09e "(value != 0) && ((value & (value-1)) == 0)", fConstrained=0)
at /nfs/rbp3/coreclr/src/utilcode/debug.cpp:436
dotnet/coreclr#7 0x7579180c in _DbgBreakCheckNoThrow (szFile=0x7587e076 "/nfs/rbp3/coreclr/src/inc/bitposition.h", iLine=27, szExpr=0x7587e09e "(value != 0) && ((value & (value-1)) == 0)",
fConstrained=0) at /nfs/rbp3/coreclr/src/utilcode/debug.cpp:548
dotnet/coreclr#8 0x75791b66 in DbgAssertDialog (szFile=0x7587e076 "/nfs/rbp3/coreclr/src/inc/bitposition.h", iLine=27, szExpr=0x7587e09e "(value != 0) && ((value & (value-1)) == 0)")
at /nfs/rbp3/coreclr/src/utilcode/debug.cpp:735
dotnet/coreclr#9 0x755e7f48 in BitPosition (value=12) at /nfs/rbp3/coreclr/src/inc/bitposition.h:27
dotnet/coreclr#10 0x755e7f0c in genLog2 (value=12) at /nfs/rbp3/coreclr/src/jit/compiler.hpp:181
dotnet/coreclr#11 0x755e7ec2 in genLog2 (value=12) at /nfs/rbp3/coreclr/src/jit/compiler.hpp:198
dotnet/coreclr#12 0x755e4b5c in genRegNumFromMask (mask=12) at /nfs/rbp3/coreclr/src/jit/compiler.hpp:494
dotnet/coreclr#13 0x75754f84 in CodeGen::genCallInstruction (this=0x8428ac, call=0x849da8) at /nfs/rbp3/coreclr/src/jit/codegenarm.cpp:1956
dotnet/coreclr#14 0x75752dbe in CodeGen::genCodeForTreeNode (this=0x8428ac, treeNode=0x849da8) at /nfs/rbp3/coreclr/src/jit/codegenarm.cpp:1132
dotnet/coreclr#15 0x755ea600 in CodeGen::genCodeForBBlist (this=0x8428ac) at /nfs/rbp3/coreclr/src/jit/codegenlinear.cpp:385
dotnet/coreclr#16 0x755db2a6 in CodeGen::genGenerateCode (this=0x8428ac, codePtr=0x7effd1ec, nativeSizeOfCode=0x7effd288) at /nfs/rbp3/coreclr/src/jit/codegencommon.cpp:3082
dotnet/coreclr#17 0x755f3654 in Compiler::compCompile (this=0x8408e8, methodCodePtr=0x7effd1ec, methodCodeSize=0x7effd288, compileFlags=0x7effd200) at /nfs/rbp3/coreclr/src/jit/compiler.cpp:4678
dotnet/coreclr#18 0x755f5928 in Compiler::compCompileHelper (this=0x8408e8, classPtr=0x76fb8010, compHnd=0x7effd8e8, methodInfo=0x7effd904, methodCodePtr=0x7effd1ec, methodCodeSize=0x7effd288,
compileFlags=0x7effd200, instVerInfo=INSTVER_GENERIC_PASSED_VERIFICATION) at /nfs/rbp3/coreclr/src/jit/compiler.cpp:5800
This is part of "Enable RyuJIT Backend for ARM32" (issue dotnet/runtime#7099).
call->gtRsvdRegs masked two registers (reg2, reg3), and pass this mask to genRegNumFromMask directly, so assertion occured.
It need to select one of masked registers and pass this to genRegNumFromMask.
@hseok-oh I think this failure is related to ryujit, since following code is only included in ryujit.
dotnet/coreclr#15 0x755ea600 in CodeGen::genCodeForBBlist (this=0x8428ac) at /nfs/rbp3/coreclr/src/jit/codegenlinear.cpp:385
@hqueue You're right. I confirmed it's related to ryujit. Thanks.
@hseok-oh Does this still reproduce? I don't see any failure on Windows ARM32, and the shown stack trace doesn't seem to exist in the code anymore.
@BruceForstall You're right. I'll close this issue.