Skip to content

[libraries-jitstress-random] Assertion failed '(emitThisGCrefRegs & regMask) == 0' during 'Emit code'  #83963

Closed

Description

@jakobbotsch

Several tests are failing with this assert, in both win-x86 and linux-arm32.
Test run: https://dev.azure.com/dnceng-public/public/_build/results?buildId=201954&view=results
Example console log: https://helixre107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-heads-main-9423de4c7e154d2480/System.Private.Xml.Tests/1/console.d22bcbec.log?helixlogtype=result

Assert failure(PID 6288 [0x00001890], Thread: 8356 [0x20a4]): Assertion failed '(emitThisGCrefRegs & regMask) == 0' in 'System.String:Concat[ushort](System.Collections.Generic.IEnumerable`1[ushort]):System.String' during 'Emit code' (IL size 417; hash 0x33a0d879; FullOpts)

    File: D:\a\_work\1\s\src\coreclr\jit\emitxarch.cpp Line: 13883
    Image: C:\h\w\A6C2090E\p\dotnet.exe

Activity

  1. ghost added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Mar 27, 2023
  2. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Mar 27, 2023
  3. added and removed
    untriagedNew issue has not been triaged by the area owner
    on Mar 27, 2023
  4. added this to the 8.0.0 milestone on Mar 27, 2023
  5. JulieLeeMSFT commented on Mar 27, 2023

    @JulieLeeMSFT
    Member

    @TIHan PTAL.

  6. TIHan commented on Mar 28, 2023

    @TIHan
    Contributor

    I have managed to reproduce this locally, so I can iterate on this.

  7. TIHan commented on Mar 28, 2023

    @TIHan
    Contributor

    I think I know the underlying problem.

    A register, edx, is assigned for a ref null node:
    CNS_INT ref null REG edx $VN.Null

    But later we decide to re-use edx for a constant zero node:
    CNS_INT int 0 reuse reg val REG edx $40

    This occurs because the two nodes are seen as equivalent, but we do not update the emitThisGCrefRegs to remove edx as GC tracked when edx is re-used in a non-GC way.

    The decision to re-use the register is handled in LSRA, though the updating of the emitThisGCrefRegs appears to only be in the emitter. A possible fix might be to update emitThisGCrefRegs if we see that we are going to emit a constant int 0 that is re-using a register that was previously GC tracked.

    // cc @kunalspathak - not sure if there needs to be something done in LSRA in this case
    full dump: dump.txt

  8. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Mar 29, 2023
  9. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Apr 4, 2023
  10. ghost locked as resolved and limited conversation to collaborators on May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIblocking-clean-ci-optionalBlocking optional rolling runs

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions