Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RyuJIT/ARM32] CoreRT failed with assert in Object::ValidateInner !CREATE_CHECK_STRING(pMT && pMT->Validate()) #8892

Closed
sergign60 opened this issue Sep 7, 2017 · 13 comments
Labels
arch-arm32 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug

Comments

@sergign60
Copy link
Contributor

create_arm_env.zip

To reproduce this you need to clone the latest coreclr, corefx, corert, build all of them for armel (tizen), create runtime environment with the (edited) script from the attachment, push it to a device and execute the following commands:

cd env_dir
export COMPlus_AltJit=*
./corerun ilc.dll --verbose  @Hello.ilc.rsp

needed jit diffs

diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 552a6dff9..008966b8b 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -2738,6 +2738,15 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
     }
 
 #ifdef ALT_JIT
+
+#ifdef _TARGET_ARM_
+    if (IsTargetAbi(CORINFO_CORERT_ABI))
+      {
+        opts.altJit = true;
+        // altJitVal = "*";
+      }
+#endif
+
     if (pfAltJit->contains(info.compMethodName, info.compClassName, &info.compMethodInfo->args))
     {
         opts.altJit = true;
@@ -2763,6 +2772,15 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
     }
 
 #ifdef ALT_JIT
+
+#ifdef _TARGET_ARM_
+    if (IsTargetAbi(CORINFO_CORERT_ABI))
+    {
+        opts.altJit = true;
+        altJitVal = "*";
+    }
+#endif
+
     // In release mode, you either get all methods or no methods. You must use "*" as the parameter, or we ignore it.
     // You don't get to give a regular expression of methods to match.
     // (Partially, this is because we haven't computed and stored the method and class name except in debug, and it

Also you probably may need to turn off jit version control in CoreRT

diff --git a/src/Native/jitinterface/jitwrapper.cpp b/src/Native/jitinterface/jitwrapper.cpp
index ec926d46..a66279af 100644
--- a/src/Native/jitinterface/jitwrapper.cpp
+++ b/src/Native/jitinterface/jitwrapper.cpp
@@ -5,6 +5,7 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <stdio.h>
 
 #include "dllexport.h"
 #include "jitinterface.h"
@@ -74,7 +75,7 @@ DLL_EXPORT int JitCompileMethod(
 
     GUID versionId;
     pJit->getVersionIdentifier(&versionId);
-    if (memcmp(&versionId, &JITEEVersionIdentifier, sizeof(GUID)) != 0)
+    if (0 && memcmp(&versionId, &JITEEVersionIdentifier, sizeof(GUID)) != 0)
     {
         // JIT and the compiler disagree on how the interface looks like.
         // Either get a matching version of the JIT from the CoreCLR repo or update the interface

I'm ready to provide any additional information

@sergign60
Copy link
Contributor Author

@sergign60
Copy link
Contributor Author

sergign60 commented Sep 7, 2017

stack trace before the assert

#0  Object::ValidateInner (this=0xb271a2c8, bDeep=1, bVerifyNextHeader=1, bVerifySyncBlock=1)
    at /share/CORERT/coreclr/src/vm/object.cpp:1735
dotnet/coreclr#1  0xb641e35c in Object::Validate (this=0xb271a2c8, bDeep=1, bVerifyNextHeader=1, bVerifySyncBlock=1)
    at /share/CORERT/coreclr/src/vm/object.cpp:1709
dotnet/coreclr#2  0xb65ca132 in GcInfoDecoder::ReportRegisterToGC (this=0xbeffcad4, regNum=4, gcFlags=0, pRD=0xbeffd3d8, 
    flags=0, pCallBack=0xb64fad2d <GcEnumObject(void*, OBJECTREF*, unsigned int)>, hCallBack=0xbeffda00)
    at /share/CORERT/coreclr/src/vm/gcinfodecoder.cpp:1578
dotnet/coreclr#3  0xb65cac48 in GcInfoDecoder::ReportSlotToGC (this=0xbeffcad4, slotDecoder=..., slotIndex=4, pRD=0xbeffd3d8, 
    reportScratchSlots=false, inputFlags=0, pCallBack=0xb64fad2d <GcEnumObject(void*, OBJECTREF*, unsigned int)>, 
    hCallBack=0xbeffda00) at /share/CORERT/coreclr/src/inc/gcinfodecoder.h:645
dotnet/coreclr#4  0xb65c910a in GcInfoDecoder::EnumerateLiveSlots (this=0xbeffcad4, pRD=0xbeffd3d8, reportScratchSlots=false, 
    inputFlags=0, pCallBack=0xb64fad2d <GcEnumObject(void*, OBJECTREF*, unsigned int)>, hCallBack=0xbeffda00)
    at /share/CORERT/coreclr/src/vm/gcinfodecoder.cpp:934
dotnet/coreclr#5  0xb63a3fd0 in EECodeManager::EnumGcRefs (this=0x56cf8, pRD=0xbeffd3d8, pCodeInfo=0xbeffd290, flags=0, 
    pCallBack=0xb64fad2d <GcEnumObject(void*, OBJECTREF*, unsigned int)>, hCallBack=0xbeffda00, 
    relOffsetOverride=4294967295) at /share/CORERT/coreclr/src/vm/eetwain.cpp:5062
dotnet/coreclr#6  0xb64fb2bc in GcStackCrawlCallBack (pCF=0xbeffd070, pData=0xbeffda00)
    at /share/CORERT/coreclr/src/vm/gcenv.ee.common.cpp:285
dotnet/coreclr#7  0xb6445204 in Thread::MakeStackwalkerCallback (this=0x645f8, pCF=0xbeffd070, 
    pCallback=0xb64faea9 <GcStackCrawlCallBack(CrawlFrame*, void*)>, pData=0xbeffda00, uFramesProcessed=6)
    at /share/CORERT/coreclr/src/vm/stackwalk.cpp:864
dotnet/coreclr#8  0xb64453a6 in Thread::StackWalkFramesEx (this=0x645f8, pRD=0xbeffd3d8, 
    pCallback=0xb64faea9 <GcStackCrawlCallBack(CrawlFrame*, void*)>, pData=0xbeffda00, flags=34048, 
    pStartFrame=0x0) at /share/CORERT/coreclr/src/vm/stackwalk.cpp:945
dotnet/coreclr#9  0xb6445c2a in Thread::StackWalkFrames (this=0x645f8, 
    pCallback=0xb64faea9 <GcStackCrawlCallBack(CrawlFrame*, void*)>, pData=0xbeffda00, flags=34048, 
    pStartFrame=0x0) at /share/CORERT/coreclr/src/vm/stackwalk.cpp:1028
dotnet/coreclr#10 0xb6745754 in ScanStackRoots (pThread=0x645f8, fn=
    0xb66336ad <WKS::GCHeap::Promote(Object**, ScanContext*, unsigned int)>, sc=0xbeffdb60)
    at /share/CORERT/coreclr/src/vm/gcenv.ee.cpp:149
dotnet/coreclr#11 0xb67454da in GCToEEInterface::GcScanRoots (
    fn=0xb66336ad <WKS::GCHeap::Promote(Object**, ScanContext*, unsigned int)>, condemned=0, max_gen=2, 
    sc=0xbeffdb60) at /share/CORERT/coreclr/src/vm/gcenv.ee.cpp:178
---Type <return> to continue, or q <return> to quit---
dotnet/coreclr#12 0xb678591a in GCScan::GcScanRoots (
    fn=0xb66336ad <WKS::GCHeap::Promote(Object**, ScanContext*, unsigned int)>, condemned=0, max_gen=2, 
    sc=0xbeffdb60) at /share/CORERT/coreclr/src/gc/gcscan.cpp:155
dotnet/coreclr#13 0xb6627ece in WKS::gc_heap::mark_phase (condemned_gen_number=0, mark_only_p=0)
    at /share/CORERT/coreclr/src/gc/gc.cpp:19585
dotnet/coreclr#14 0xb6625e16 in WKS::gc_heap::gc1 () at /share/CORERT/coreclr/src/gc/gc.cpp:15396
dotnet/coreclr#15 0xb662e1cc in WKS::gc_heap::garbage_collect (n=0) at /share/CORERT/coreclr/src/gc/gc.cpp:16947
dotnet/coreclr#16 0xb6622320 in WKS::GCHeap::GarbageCollectGeneration (this=0x4aed8, gen=0, reason=reason_alloc_soh)
    at /share/CORERT/coreclr/src/gc/gc.cpp:35074
dotnet/coreclr#17 0xb66236ac in WKS::gc_heap::try_allocate_more_space (acontext=0x64638, size=152, gen_number=0)
    at /share/CORERT/coreclr/src/gc/gc.cpp:13198
dotnet/coreclr#18 0xb662379c in WKS::gc_heap::allocate_more_space (acontext=0x64638, size=152, alloc_generation_number=0)
    at /share/CORERT/coreclr/src/gc/gc.cpp:13494
dotnet/coreclr#19 0xb664b764 in WKS::gc_heap::allocate (jsize=152, acontext=0x64638)
    at /share/CORERT/coreclr/src/gc/gc.cpp:13525
dotnet/coreclr#20 0xb664382c in WKS::GCHeap::Alloc (this=0x4aed8, context=0x64638, size=152, flags=0)
    at /share/CORERT/coreclr/src/gc/gc.cpp:34416
dotnet/coreclr#21 0xb64fd806 in Alloc (size=152, bFinalize=0, bContainsPointers=0)
    at /share/CORERT/coreclr/src/vm/gchelpers.cpp:241
dotnet/coreclr#22 0xb64fcf1a in SlowAllocateString (cchStringLength=68) at /share/CORERT/coreclr/src/vm/gchelpers.cpp:1035
dotnet/coreclr#23 0xb6516a10 in FramedAllocateString (stringLength=68) at /share/CORERT/coreclr/src/vm/jithelpers.cpp:2931
dotnet/coreclr#24 0xaf0ce4a0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

values of the variables

in Object::ValidateInner (this=0xb271a2c8, bDeep=1, bVerifyNextHeader=1, 
    bVerifySyncBlock=1) at /share/CORERT/coreclr/src/vm/object.cpp
p this
$1 = (Object *) 0xb271a2c8
(gdb) x this
0xb271a2c8:	0x00000000
(gdb) p pMT
$2 = (MethodTable *) 0x0

in GcInfoDecoder::ReportRegisterToGC (this=0xbeffcad4, regNum=4, gcFlags=0, pRD=0xbeffd3d8, 
    flags=0, pCallBack=0xb64fad2d <GcEnumObject(void*, OBJECTREF*, unsigned int)>, hCallBack=0xbeffda00)
    at /share/CORERT/coreclr/src/vm/gcinfodecoder.cpp
p pObjRef
$3 = (OBJECTREF *) 0xbeffe360
(gdb) x (OBJECTREF *) 0xbeffe360
0xbeffe360:	0xb271a2c8

in GcInfoDecoder::ReportSlotToGC (this=0xbeffcad4, slotDecoder=..., slotIndex=4, pRD=0xbeffd3d8, 
    reportScratchSlots=false, inputFlags=0, pCallBack=0xb64fad2d <GcEnumObject(void*, OBJECTREF*, unsigned int)>, 
    hCallBack=0xbeffda00) at /share/CORERT/coreclr/src/inc/gcinfodecoder.h
p pRD
$4 = (PREGDISPLAY) 0xbeffd3d8
p *pRD
$5 = {<REGDISPLAY_BASE> = {pContext = 0x0, pCurrentContext = 0xbeffd3f8, pCallerContext = 0xbeffd598, 
    pCurrentContextPointers = 0xbeffd738, pCallerContextPointers = 0xbeffd77c, IsCallerContextValid = 1, 
    IsCallerSPValid = 0, ctxOne = {ContextFlags = 536870912, R0 = 0, R1 = 0, R2 = 0, R3 = 0, R4 = 2993791688, 
      R5 = 3204441236, R6 = 0, R7 = 3204442560, R8 = 3204444688, R9 = 1611470848, R10 = 0, R11 = 3204440976, 
      R12 = 0, Sp = 3204440944, Lr = 2929892869, Pc = 2929892869, Cpsr = 0, Fpscr = 0, Padding = 0, {Q = {{
            Low = 0, High = 0} <repeats 16 times>}, D = {0 <repeats 32 times>}, S = {0 <repeats 32 times>}}, 
      Bvr = {0, 0, 0, 0, 0, 0, 0, 0}, Bcr = {0, 0, 0, 0, 0, 0, 0, 0}, Wvr = {0}, Wcr = {0}, Padding2 = {0, 0}}, 
    ctxTwo = {ContextFlags = 536870912, R0 = 0, R1 = 0, R2 = 0, R3 = 0, R4 = 0, R5 = 3204441236, R6 = 0, 
      R7 = 3204442560, R8 = 3204444688, R9 = 1611470848, R10 = 0, R11 = 3204441008, R12 = 0, Sp = 3204440984, 
      Lr = 2922272541, Pc = 2922272541, Cpsr = 0, Fpscr = 0, Padding = 0, {Q = {{Low = 0, 
            High = 0} <repeats 16 times>}, D = {0 <repeats 32 times>}, S = {0 <repeats 32 times>}}, Bvr = {0, 0, 
        0, 0, 0, 0, 0, 0}, Bcr = {0, 0, 0, 0, 0, 0, 0, 0}, Wvr = {0}, Wcr = {0}, Padding2 = {0, 0}}, 
    ctxPtrsOne = {R4 = 0xbeffe360, R5 = 0xbeffe244, R6 = 0xbeffe248, R7 = 0xbeffe1a8, R8 = 0xbeffe160, 
      R9 = 0xbeffe164, R10 = 0xbeffe364, R11 = 0xbeffe368, Lr = 0xbeffe36c, D8 = 0x0, D9 = 0x0, D10 = 0x0, 
      D11 = 0x0, D12 = 0x0, D13 = 0x0, D14 = 0x0, D15 = 0x0}, ctxPtrsTwo = {R4 = 0xbeffe388, R5 = 0xbeffe244, 
      R6 = 0xbeffe248, R7 = 0xbeffe1a8, R8 = 0xbeffe160, R9 = 0xbeffe164, R10 = 0xbeffe38c, R11 = 0xbeffe390, 
      Lr = 0xbeffe394, D8 = 0x0, D9 = 0x0, D10 = 0x0, D11 = 0x0, D12 = 0x0, D13 = 0x0, D14 = 0x0, D15 = 0x0}, 
    _pThread = 0x645f8, SP = 3204440944, ControlPC = 2929892869}, volatileCurrContextPointers = {R0 = 0x0, 
    R1 = 0x0, R2 = 0x0, R3 = 0x0, R12 = 0x0}, pPC = 0xbeffd438}

in GcStackCrawlCallBack (pCF=0xbeffd070, pData=0xbeffda00)
    at /share/CORERT/coreclr/src/vm/gcenv.ee.common.cpp
p pMD
$7 = (MethodDesc *) 0xaeaf92e0
(gdb) p *pMD
$8 = {m_pszDebugMethodName = 0xb6a3377a "IL_STUB_SecureDelegate_Invoke", 
  m_pszDebugClassName = 0xb6a7d0f1 "DomainNeutralILStubClass", 
  m_pszDebugMethodSignature = 0xaeaf9358 "instance void *(!0)", m_pDebugMethodTable = {static isRelative = false, 
    m_addr = 2969901956}, m_GcCover = 0x0, m_wFlags3AndTokenRemainder = 0, m_chunkIndex = 0 '\000', 
  m_bFlags2 = 8 '\b', m_wSlotNumber = 65535, m_wFlags = 32783, static s_ClassificationSizeTable = 
    0xb6a06318 <MethodDesc::s_ClassificationSizeTable>}

@sergign60
Copy link
Contributor Author

sergign60 commented Sep 7, 2017

; Assembly listing for method DomainNeutralILStubClass:IL_STUB_SecureDelegate_Invoke(ref):ref:this
; Emitting BLENDED_CODE for generic ARM CPU
; debuggable code
; r11 based frame
; fully interruptible
; Final local variable assignments
;
;  V00 this         [V00,T01] (  3,  3   )     ref  ->  [sp+0x14]   do-not-enreg[] this class-hnd
;  V01 arg1         [V01,T02] (  3,  3   )     ref  ->  [sp+0x10]   do-not-enreg[] class-hnd
;  V02 tmp0         [V02,T00] (  3,  6   )     ref  ->  [sp+0x0C]   do-not-enreg[] must-init
;  V03 tmp1         [V03,T03] (  2,  4   )     ref  ->  [sp+0x08]   do-not-enreg[] must-init
;# V04 OutArgs      [V04    ] (  1,  1   )  lclBlk ( 0) [sp+0x00]   do-not-enreg[]
;  V05 tmp3         [V05,T04] (  2,  4   )     ref  ->  [sp+0x04]   do-not-enreg[] must-init
;
; Lcl frame size = 24

G_M61106_IG01:
000000  E92D 4C10      push    {r4,r10,r11,lr}
000004  B086           sub     sp, 24
000006  F10D 0B20      add     r11, sp, 32
00000A  2200           movs    r2, 0
00000C  9203           str     r2, [sp+0x0c]	// [V02 tmp0]
00000E  9202           str     r2, [sp+0x08]	// [V03 tmp1]
000010  9201           str     r2, [sp+0x04]	// [V05 tmp3]
000012  9005           str     r0, [sp+0x14]	// [V00 this]
000014  9104           str     r1, [sp+0x10]	// [V01 arg1]

G_M61106_IG02:
000016  9805           ldr     r0, [sp+0x14]
000018  6940           ldr     r0, [r0+20]
00001A  9003           str     r0, [sp+0x0c]	// [V02 tmp0]
00001C  9803           ldr     r0, [sp+0x0c]	// [V02 tmp0]
00001E  9002           str     r0, [sp+0x08]	// [V03 tmp1]
000020  9802           ldr     r0, [sp+0x08]	// [V03 tmp1]
000022  9001           str     r0, [sp+0x04]	// [V05 tmp3]
000024  9801           ldr     r0, [sp+0x04]	// [V05 tmp3]
000026  1D00           adds    r0, r0, 4
000028  6800           ldr     r0, [r0]
00002A  9903           ldr     r1, [sp+0x0c]	// [V02 tmp0]
00002C  F101 0410      add     r4, r1, 16
000030  9904           ldr     r1, [sp+0x10]	// [V01 arg1]
000032  9B01           ldr     r3, [sp+0x04]	// [V05 tmp3]
000034  68DB           ldr     r3, [r3+12]
000036  4798           blx     r3		// System.Func`2[__Canon,__Canon][System.__Canon,System.__Canon]:Invoke(ref):ref:this

G_M61106_IG03:
000038  B006           add     sp, 24
00003A  E8BD 8C10      pop     {r4,r10,r11,pc}

; Total bytes of code 62, prolog size 22 for method DomainNeutralILStubClass:IL_STUB_SecureDelegate_Invoke(ref):ref:this
; ============================================================

; Assembly listing for method DomainBoundILStubClass:IL_STUB_SecureDelegate_Invoke(struct):ref:this
; Emitting BLENDED_CODE for generic ARM CPU
; debuggable code
; r11 based frame
; fully interruptible
; Final local variable assignments
;
;  V00 this         [V00,T01] (  3,  3   )     ref  ->  [sp+0x0C]   do-not-enreg[] this class-hnd
;  V01 arg1         [V01,T02] (  4,  4   )  struct ( 8) [sp+0x20]   do-not-enreg[SFA] multireg-arg
;  V02 tmp0         [V02,T00] (  3,  6   )     ref  ->  [sp+0x08]   do-not-enreg[] must-init
;  V03 tmp1         [V03,T03] (  2,  4   )     ref  ->  [sp+0x04]   do-not-enreg[] must-init
;# V04 OutArgs      [V04    ] (  1,  1   )  lclBlk ( 0) [sp+0x00]   do-not-enreg[]
;  V05 tmp3         [V05,T04] (  2,  4   )     ref  ->  [sp+0x00]   do-not-enreg[] must-init
;
; Lcl frame size = 16

G_M22107_IG01:
000000  B406           push    {r1,r2}
000002  E92D 4C10      push    {r4,r10,r11,lr}
000006  B084           sub     sp, 16
000008  F10D 0B18      add     r11, sp, 24
00000C  2100           movs    r1, 0
00000E  9102           str     r1, [sp+0x08]	// [V02 tmp0]
000010  9101           str     r1, [sp+0x04]	// [V03 tmp1]
000012  9100           str     r1, [sp]	// [V05 tmp3]
000014  9003           str     r0, [sp+0x0c]	// [V00 this]

G_M22107_IG02:
000016  9803           ldr     r0, [sp+0x0c]
000018  6940           ldr     r0, [r0+20]
00001A  9002           str     r0, [sp+0x08]	// [V02 tmp0]
00001C  9802           ldr     r0, [sp+0x08]	// [V02 tmp0]
00001E  9001           str     r0, [sp+0x04]	// [V03 tmp1]
000020  9801           ldr     r0, [sp+0x04]	// [V03 tmp1]
000022  9000           str     r0, [sp]	// [V05 tmp3]
000024  9800           ldr     r0, [sp]	// [V05 tmp3]
000026  1D00           adds    r0, r0, 4
000028  6800           ldr     r0, [r0]
00002A  9908           ldr     r1, [sp+0x20]	// [V01 arg1]
00002C  9A09           ldr     r2, [sp+0x24]	// [V01 arg1+0x04]
00002E  9B02           ldr     r3, [sp+0x08]	// [V02 tmp0]
000030  F103 0410      add     r4, r3, 16
000034  9B00           ldr     r3, [sp]	// [V05 tmp3]
000036  68DB           ldr     r3, [r3+12]
000038  4798           blx     r3		// System.Func`2[ReadyToRunHelperKey,__Canon][ILCompiler.DependencyAnalysis.NodeFactory+ReadyToRunHelperKey,System.__Canon]:Invoke(struct):ref:this

G_M22107_IG03:
00003A  B004           add     sp, 16
00003C  E8BD 4C10      pop     {r4,r10,r11,lr}
000040  B002           add     sp, 8
000042  4770           bx      lr

; Total bytes of code 68, prolog size 22 for method DomainBoundILStubClass:IL_STUB_SecureDelegate_Invoke(struct):ref:this
; ============================================================

; Assembly listing for method DomainNeutralILStubClass:IL_STUB_SecureDelegate_Invoke(ref):this
; Emitting BLENDED_CODE for generic ARM CPU
; debuggable code
; r11 based frame
; fully interruptible
; Final local variable assignments
;
;  V00 this         [V00,T01] (  3,  3   )     ref  ->  [sp+0x14]   do-not-enreg[] this class-hnd
;  V01 arg1         [V01,T02] (  3,  3   )     ref  ->  [sp+0x10]   do-not-enreg[] class-hnd
;  V02 tmp0         [V02,T00] (  3,  6   )     ref  ->  [sp+0x0C]   do-not-enreg[] must-init
;  V03 tmp1         [V03,T03] (  2,  4   )     ref  ->  [sp+0x08]   do-not-enreg[] must-init
;# V04 OutArgs      [V04    ] (  1,  1   )  lclBlk ( 0) [sp+0x00]   do-not-enreg[]
;  V05 tmp3         [V05,T04] (  2,  4   )     ref  ->  [sp+0x04]   do-not-enreg[] must-init
;
; Lcl frame size = 24

G_M53937_IG01:
000000  E92D 4C10      push    {r4,r10,r11,lr}
000004  B086           sub     sp, 24
000006  F10D 0B20      add     r11, sp, 32
00000A  2200           movs    r2, 0
00000C  9203           str     r2, [sp+0x0c]	// [V02 tmp0]
00000E  9202           str     r2, [sp+0x08]	// [V03 tmp1]
000010  9201           str     r2, [sp+0x04]	// [V05 tmp3]
000012  9005           str     r0, [sp+0x14]	// [V00 this]
000014  9104           str     r1, [sp+0x10]	// [V01 arg1]

G_M53937_IG02:
000016  9805           ldr     r0, [sp+0x14]
000018  6940           ldr     r0, [r0+20]
00001A  9003           str     r0, [sp+0x0c]	// [V02 tmp0]
00001C  9803           ldr     r0, [sp+0x0c]	// [V02 tmp0]
00001E  9002           str     r0, [sp+0x08]	// [V03 tmp1]
000020  9802           ldr     r0, [sp+0x08]	// [V03 tmp1]
000022  9001           str     r0, [sp+0x04]	// [V05 tmp3]
000024  9801           ldr     r0, [sp+0x04]	// [V05 tmp3]
000026  1D00           adds    r0, r0, 4
000028  6800           ldr     r0, [r0]
00002A  9903           ldr     r1, [sp+0x0c]	// [V02 tmp0]
00002C  F101 0410      add     r4, r1, 16
000030  9904           ldr     r1, [sp+0x10]	// [V01 arg1]
000032  9B01           ldr     r3, [sp+0x04]	// [V05 tmp3]
000034  68DB           ldr     r3, [r3+12]
000036  4798           blx     r3		// System.Action`1[__Canon][System.__Canon]:Invoke(ref):this

G_M53937_IG03:
000038  B006           add     sp, 24
00003A  E8BD 8C10      pop     {r4,r10,r11,pc}

; Total bytes of code 62, prolog size 22 for method DomainNeutralILStubClass:IL_STUB_SecureDelegate_Invoke(ref):this
; ============================================================

@sergign60
Copy link
Contributor Author

sergign60 commented Sep 7, 2017

are the commands

00002C  F101 0410      add     r4, r1, 16

000030  F103 0410      add     r4, r3, 16

00002C  F101 0410      add     r4, r1, 16

a dead code here because of r4 isn't used later?

I'm very novice in GC story so any help will be appreciated. This issue is the showstopper for CoreRT armel tizen project now

@jkotas
Copy link
Member

jkotas commented Sep 7, 2017

a dead code here because of r4 isn't used later?

This is non-standard calling convention. Look for GTF_CALL_M_SECURE_DELEGATE_INV.

@jkotas
Copy link
Member

jkotas commented Sep 7, 2017

This looks like a bad GC info generated for the GTF_CALL_M_SECURE_DELEGATE_INV case.

The one problem that I see is on this line:

            GenTree* newArg = new (this, GT_ADDR)
                GenTreeAddrMode(TYP_REF, arg, nullptr, 0, eeGetEEInfo()->offsetOfSecureDelegateIndirectCell);

TYP_REF does not look right here. I think it should be TYP_BYREF.

@sergign60
Copy link
Contributor Author

sergign60 commented Sep 7, 2017

@jkotas Thanks! With this fix this assert's gone. We have another assertion namely

Assert Failure
Expression: [Recursive resource lookup bug]
Description: Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: IO_EOF_ReadBeyondEOF
Stack Trace:
   at System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.SR.get_IO_EOF_ReadBeyondEOF()
   at System.IO.__Error.EndOfFile()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt32()
   at System.Resources.ManifestBasedResourceGroveler.CreateResourceSet(Stream store, Assembly assembly)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.SR.get_IO_EOF_ReadBeyondEOF()
   at System.IO.__Error.EndOfFile()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt32()
   at System.Resources.ManifestBasedResourceGroveler.CreateResourceSet(Stream store, Assembly assembly)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.SR.get_Word_At()
   at System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat)
   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Exception.GetStackTrace(Boolean needFileInfo)
   at System.Exception.ToString(Boolean needFileLineInfo, Boolean needMessage)
   at System.Exception.ToString()
   at Internal.JitInterface.CorInfoImpl.AllocException(Exception ex)
   at Internal.JitInterface.CorInfoImpl._getFunctionEntryPoint(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* ftn, CORINFO_CONST_LOOKUP& pResult, CORINFO_ACCESS_FLAGS accessFlags)
   at Internal.JitInterface.CorInfoImpl.JitCompileMethod(IntPtr& exception, IntPtr jit, IntPtr thisHandle, IntPtr callbacks, CORINFO_METHOD_INFO& info, UInt32 flags, IntPtr& nativeEntry, UInt32& codeSize)
   at Internal.JitInterface.CorInfoImpl.CompileMethod(IMethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
   at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1 obj)
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeDependencies(List`1 deferredStaticDependencies)
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes()
   at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper)
   at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper)
   at ILCompiler.Program.Run(String[] args)
   at ILCompiler.Program.Main(String[] args)

but the compilation process has progressed much further, so I think that it's another story.

Should I prepare the PR or you will do it?

@jkotas
Copy link
Member

jkotas commented Sep 7, 2017

Prepare the PR for it please.

sergign60 referenced this issue in sergign60/coreclr Sep 7, 2017
@sergign60
Copy link
Contributor Author

dotnet/coreclr#13831

@jkotas
Copy link
Member

jkotas commented Sep 7, 2017

I think that it's another story.

https://github.com/dotnet/coreclr/issues/12659#issuecomment-315309194 has the same crash. Not sure whether it was fixed.

jkotas referenced this issue in dotnet/coreclr Sep 7, 2017
@jkotas jkotas closed this as completed Sep 7, 2017
@danmoseley
Copy link
Member

@tarekgh the resources callstack above is not https://github.com/dotnet/coreclr/issues/12668. Does it look like it needs a corefx bug opened? I thought resource lookups tried to catch all exceptions to avoid recursion.

@tarekgh
Copy link
Member

tarekgh commented Sep 11, 2017

@danmosemsft

the resources callstack above is not #8503. Does it look like it needs a corefx bug opened? I thought resource lookups tried to catch all exceptions to avoid recursion.

We are currently failing fast. We have discussed that before and @jkotas mentioned the following

Resource loading is very low level system because of everything else in CoreLib depends on it. If it stops working for CoreLib resources, there is something seriously wrong. The process will very likely crash soon anyway. Changing fail fast to anything else won’t change this fact. It is not that different from other fatal errors like GC heap corruption. We fail fast when we run into one; we do not try to recover with fingers crossed that we maybe survive it.

@danmoseley
Copy link
Member

@tarekgh failfast is fine, I was wondering if there is a bug to fix.

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-arm32 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug
Projects
None yet
Development

No branches or pull requests

4 participants