Skip to content

Assertion failed 'node->DefinesLocalAddr(this, size, &lcl, nullptr) && lvaGetDesc(lcl)->lvHiddenBufferStructArg' #68669

Closed

Description

@BruceForstall

pipeline: runtime-coreclr libraries-jitstress
Test: System.Reflection.MetadataLoadContext.Tests
JitStress=1
Failed for both win-x64 and linux-arm

https://dev.azure.com/dnceng/public/_build/results?buildId=1741924&view=ms.vss-test-web.build-test-results-tab&runId=47086172&resultId=193772&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab

+ printenv
+ grep COMPlus
COMPlus_TieredCompilation=0
COMPlus_JitStress=1
COMPlus_DbgMiniDumpName=/home/helixbot/dotnetbuild/dumps/coredump.%d.dmp
COMPlus_DbgEnableMiniDump=1
+ ./RunTests.sh --runtime-path /root/helix/work/correlation
----- start Thu Apr 28 07:47:43 UTC 2022 =============== To repro directly: =====================================================
pushd .
/root/helix/work/correlation/dotnet exec --runtimeconfig System.Reflection.MetadataLoadContext.Tests.runtimeconfig.json --depsfile System.Reflection.MetadataLoadContext.Tests.deps.json xunit.console.dll System.Reflection.MetadataLoadContext.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing 
popd
===========================================================================================================
/root/helix/work/workitem/e /root/helix/work/workitem/e
  Discovering: System.Reflection.MetadataLoadContext.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Reflection.MetadataLoadContext.Tests (found 493 of 494 test cases)
  Starting:    System.Reflection.MetadataLoadContext.Tests (parallel test collections = on, max threads = 4)

Assert failure(PID 61 [0x0000003d], Thread: 75 [0x004b]): Assertion failed 'node->DefinesLocalAddr(this, size, &lcl, nullptr) && lvaGetDesc(lcl)->lvHiddenBufferStructArg' in 'System.Reflection.TypeLoading.Ecma.EcmaEvent:ComputeEventRaiseMethod():System.Reflection.TypeLoading.RoMethod:this' during 'Morph - Global' (IL size 37; hash 0x941ee672; FullOpts)

    File: /__w/1/s/src/coreclr/jit/gentree.cpp Line: 17913
    Image: /root/helix/work/correlation/dotnet

@dotnet/jit-contrib

Activity

  1. added
    JitStress
    area-CodeGen-coreclr
    on Apr 28, 2022
  2. added this to the 7.0.0 milestone on Apr 28, 2022
  3. ghost added
    untriaged
    on Apr 28, 2022
  4. removed
    untriaged
    on Apr 28, 2022
  5. self-assigned this
    on Apr 28, 2022
  6. jakobbotsch commented on Apr 28, 2022

    @jakobbotsch
    Member

    One part of the problem is that we end up with a GTF_GLOB_REF on a GT_ADDR node because the following does not handle locals generally:

    runtime/src/coreclr/jit/morph.cpp

    Lines 11190 to 11193 in 11bff1a

    if (oper == GT_ADDR && (op1->gtOper == GT_LCL_VAR))
    {
    tree->gtFlags &= ~GTF_GLOB_REF;
    }

    It means we end up evaluating the retbuf into a temp and stop being able to recognize it.
    This seems to end up happening because in this case we have an isTmp local for the retbuf we are optimizing, and this local is address exposed besides as the ret buf:

    [000198] S-C-G------                         ▌  CALL      void   System.Reflection.TypeLoading.Ecma.MetadataExtensions.GetMethodDefinition
    [000203] ----------- retbuf                  ├──▌  ADDR      byref 
    [000202] -------N---                         │  └──▌  FIELD     struct _neverAccessThisExceptThroughMethodDefinitionProperty
    [000191] -----------                         │     └──▌  ADDR      byref 
    [000192] -------N---                         │        └──▌  LCL_VAR   struct<System.Reflection.TypeLoading.Ecma.EcmaMethodDecoder, 32>(AX)(RB) V16 tmp14        
    [000200] n---------- arg1                    ├──▌  OBJ       struct<System.Reflection.Metadata.MethodDefinitionHandle, 4>
    [000199] -----------                         │  └──▌  ADDR      byref 
    [000193] -------N---                         │     └──▌  LCL_VAR   struct<System.Reflection.Metadata.MethodDefinitionHandle, 4> V18 tmp16        
    [000196] --C-G------ arg2                    └──▌  CALL      ref    System.Reflection.TypeLoading.Ecma.EcmaMethodDecoder.get_Reader
    [000194] ----------- this                       └──▌  LCL_VAR_ADDR byref  V16 tmp14

    @kunalspathak said he would take a closer look.

  7. added a commit that references this issue on May 1, 2022
    c5f25f3
  8. ghost added
    in-pr
    on May 1, 2022
  9. jakobbotsch commented on May 1, 2022

    @jakobbotsch
    Member

    #68741 at least fixes introducing the unnecessary temp which resolves the assert. However, I think we should leave this open just to investigate whether it is in general safe to do the ret buf optimization here. I suppose yes, since the local does end up marked as address exposed and will not actually be tracked.

    I have attached a SPMI context for the compile where it happens which I collected on git hash 5c2a738 (with the fix from #68741 applied). The above tree comes from around line 4334 in the JIT dump.

    context.zip

  10. added a commit that references this issue on May 2, 2022
    ff6af23
  11. ghost removed
    in-pr
    on May 2, 2022
  12. ghost locked as resolved and limited conversation to collaborators on Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

JitStressarea-CodeGen-coreclr

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions