Skip to content

Crossgen2 composite framework build emits OptimizedInboxTextEncoder layout mismatched with the CoreCLR runtime #64419

Description

@trylek

Architecture: 64-bit
OS: all
Example run: https://dev.azure.com/dnceng/public/_build/results?buildId=1574573&view=results

Diagnostic information:

      Assert failure(PID 1408 [0x00000580], Thread: 2176 [0x0880]): Verify_FieldOffset 'System.Text.Encodings.Web.OptimizedInboxTextEncoder._allowedAsciiCodePoints' Field offset 16!=24(actual) || baseOffset 8!=8(actual)
      
      CORECLR! LoadDynamicInfoEntry + 0x11C1 (0x00007ffb`0ec98e71)
      CORECLR! Module::FixupNativeEntry + 0x280 (0x00007ffb`0eb7d190)
      CORECLR! Module::FixupDelayListAux + 0x6AD (0x00007ffb`0ee0d88d)
      CORECLR! ReadyToRunInfo::GetEntryPoint + 0x64A (0x00007ffb`0ee0ff4a)
      CORECLR! MethodDesc::GetPrecompiledR2RCode + 0xDA (0x00007ffb`0ed5eb1a)
      CORECLR! MethodDesc::GetPrecompiledCode + 0xD1 (0x00007ffb`0ed5e711)
      CORECLR! MethodDesc::PrepareILBasedCode + 0x3B0 (0x00007ffb`0ed62030)
      CORECLR! MethodDesc::PrepareCode + 0xE8 (0x00007ffb`0ed61c28)
      CORECLR! CodeVersionManager::PublishVersionableCodeIfNecessary + 0x3F3 (0x00007ffb`0ebe5433)
      CORECLR! MethodDesc::DoPrestub + 0xC0E (0x00007ffb`0ed5aafe)
          File: D:\a\_work\1\s\src\coreclr\vm\jitinterface.cpp Line: 13642
          Image: C:\h\w\AF87095D\p\corerun.exe

At the first glance it seems to me that this is caused by mismatching classification of the type by Crossgen2 and the runtime. Crossgen2 query for

else if (type.IsSequentialLayout && !type.ContainsGCPointers)

doesn't hit the sequential path because the type does contain GC pointers, however the check in

if (IsBlittable() || IsManagedSequential())

does classify the type as Blittable and enters the sequential layout path.

/cc @dotnet/crossgen-contrib, @jkoritzinsky

Activity

  1. added this to the 7.0.0 milestone on Jan 28, 2022
  2. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Jan 28, 2022
  3. jkoritzinsky commented on Jan 28, 2022

    @jkoritzinsky
    Member

    The definition for IsManagedSequential() in CoreCLR now effectively is IsSequentialLayout && !ContainsGCPointers, so something more nuanced is probably going on here.

  4. jkoritzinsky commented on Jan 28, 2022

    @jkoritzinsky
    Member

    I wonder why this type is classified as blittable if it has GC pointers in it...

  5. removed
    untriagedNew issue has not been triaged by the area owner
    on Jan 28, 2022
  6. mangod9 commented on Jul 19, 2022

    @mangod9
    Member

    @trylek @jkoritzinsky is this something we plan on fixing for 7?

  7. trylek commented on Jul 19, 2022

    @trylek
    MemberAuthor

    We should try to unless the fix turns out to be risky and potentially destabilizing; according to JanK we should strive to fix most layout mismatch bugs so that we don't have to make additional breaking R2R changes in .NET 8.

  8. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Jul 19, 2022
  9. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Jul 20, 2022
  10. ghost locked as resolved and limited conversation to collaborators on Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions