Bug 50789

Summary: JITting large method fails (condition lvregs_len < 1024 not met)
Product: [Mono] Runtime Reporter: domi1819 <abgebaut>
Component: JITAssignee: Bugzilla <bugzilla>
Severity: normal CC: mono-bugs+mono, mono-bugs+runtime, vargaz
Priority: ---    
Version: 4.6.0 (C8)   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Source code that triggers the bug

Description domi1819 2016-12-25 19:18:32 UTC
Created attachment 18990 [details]
Source code that triggers the bug

I've got a Blake2 hash implementation where the compression method is unrolled. That method spans about 1300 lines.
Running this on a freshly-installed Debian 8 with Mono crashes, presumably when Mono tries to JIT the compression method. A class that compiles with mcs and triggers that bug is attached.

This issue was already reported as https://bugzilla.xamarin.com/show_bug.cgi?id=22150 but wrongly categorized and then abandoned.

upserver@debian:~$ mono Blake2.exe
* Assertion at method-to-ir.c:14949, condition `lvregs_len < 1024' not met


  at <unknown> <0xffffffff>
  at domi1819.UpCore.Crypto.Blake2.Hash (byte[],byte,byte[]) <0x0029b>
  at domi1819.UpCore.Crypto.Blake2.Main () <0x0002b>
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0x000ba>

Native stacktrace:

        mono() [0x4accca]
        /lib/x86_64-linux-gnu/libpthread.so.0(+0xf8d0) [0x7f12a71478d0]
        /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37) [0x7f12a6ba5067]
        /lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x7f12a6ba6448]
        mono() [0x65aae9]
        mono() [0x65acf7]
        mono() [0x65ae46]
        mono() [0x47155a]
        mono() [0x50f63f]
        mono() [0x510253]
        mono() [0x425efc]
        mono() [0x4af809]
        mono() [0x4b0230]

Debug info from gdb:

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

Comment 1 Zoltan Varga 2017-01-16 00:59:09 UTC
Fixed by mono master bf1862930b890472e6f93df4ad7e08f1d7620191.