Skip to content

ILC crashes on x64, works on arm64 #99611

Closed

Description

@rolfbjarne

Description

ILC crashes on x64, works on arm64.

In other words, this works:

[...]/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/9.0.0-preview.3.24157.12/tools/ilc" @"obj/Debug/net9.0-macos/osx-arm64/native/monotouchtest.ilc.rsp"

this does not:

[...]/packages/runtime.osx-x64.microsoft.dotnet.ilcompiler/9.0.0-preview.3.24157.12/tools/ilc" @"obj/Debug/net9.0-macos/osx-arm64/native/monotouchtest.ilc.rsp"

Reproduction Steps

Repro using --make-repro-path: 834971237_monotouchtest.zip

Expected behavior

Same behavior between arm64 and x64 (preferrably no crashes in either).

Actual behavior

Crash on x64: https://gist.github.com/rolfbjarne/bfa59a2999b165673b162e65e0c36d53

Thread 27 Crashed:
0   <translation info unavailable>	       0x1048c5da0 ???
1   libsystem_platform.dylib      	    0x7ff805c7eff3 _sigtramp + 51
2   libclrjit_universal_arm64_x64.dylib	       0x11b708c86 CodeGen::genCodeForCpObj(GenTreeBlk*) + 934
3   libclrjit_universal_arm64_x64.dylib	       0x11b571d51 CodeGen::genCodeForBBlist() + 1745
4   libclrjit_universal_arm64_x64.dylib	       0x11b56a725 CodeGen::genGenerateMachineCode() + 981
5   libclrjit_universal_arm64_x64.dylib	       0x11b571422 CodeGenPhase::DoPhase() + 34
6   libclrjit_universal_arm64_x64.dylib	       0x11b6aae38 Phase::Run() + 24
7   libclrjit_universal_arm64_x64.dylib	       0x11b56a2bd CodeGen::genGenerateCode(void**, unsigned int*) + 109
8   libclrjit_universal_arm64_x64.dylib	       0x11b578de2 Compiler::compCompile(void**, unsigned int*, JitFlags*) + 6482
9   libclrjit_universal_arm64_x64.dylib	       0x11b57af01 Compiler::compCompileHelper(CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*) + 1425
10  libclrjit_universal_arm64_x64.dylib	       0x11b57a228 Compiler::compCompile(CORINFO_MODULE_STRUCT_*, void**, unsigned int*, JitFlags*) + 1272
11  libclrjit_universal_arm64_x64.dylib	       0x11b57baab jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*) + 539
12  libclrjit_universal_arm64_x64.dylib	       0x11b57fd69 CILJit::compileMethod(ICorJitInfo*, CORINFO_METHOD_INFO*, unsigned int, unsigned char**, unsigned int*) + 121

Regression?

Yes, this started happening in a maestro bump (dotnet/macios#20249).

So looks like somewhere in this range: 5e603d5...8510651

Known Workarounds

Use an Intel Mac.

Configuration

No response

Other information

No response

Activity

  1. ghost added
    area-CodeGen-coreclr
    on Mar 12, 2024
  2. added
    untriaged
    on Mar 12, 2024
  3. rolfbjarne commented on Mar 12, 2024

    @rolfbjarne
    MemberAuthor
  4. EgorBo commented on Mar 12, 2024

    @EgorBo
    Member

    Looks like it could be caused by #99140

  5. self-assigned this
    on Mar 12, 2024
  6. removed
    untriaged
    on Mar 12, 2024
  7. added this to the 9.0.0 milestone on Mar 12, 2024
  8. EgorBo commented on Mar 12, 2024

    @EgorBo
    Member

    Although, I am not sure, that change only changes arm64 inside the JIT so shouldn't affect x64 anyhow (it's not even included for the x64 jit) 🤔

  9. EgorBo commented on Mar 12, 2024

    @EgorBo
    Member

    @rolfbjarne I presume it happens on Rosetta, right?

  10. EgorBo commented on Mar 12, 2024

    @EgorBo
    Member

    @rolfbjarne I presume it happens on Rosetta, right?

    Ah, it's x64 emitting code for arm64 target (crosscompile)

  11. rolfbjarne commented on Mar 13, 2024

    @rolfbjarne
    MemberAuthor

    @rolfbjarne I presume it happens on Rosetta, right?

    Both Rosetta and Intel macs.

  12. rolfbjarne commented on Mar 18, 2024

    @rolfbjarne
    MemberAuthor

    @EgorBo any updates on this?

  13. steveisok commented on Mar 21, 2024

    @steveisok
    Member
  14. EgorBo commented on Mar 22, 2024

    @EgorBo
    Member

    Sorry for the delay, the repro is not working for me, fails with

    System.InvalidOperationException: Expected field '_firstParameter' not found on type '[S.P.CoreLib]System.Delegate'
    

    and I don't see any obvious issues in #99140, so I decided to revert it in #100143 and will take a look at it again later once I am less busy

  15. jkotas commented on Mar 22, 2024

    @jkotas
    Member

    System.InvalidOperationException: Expected field '_firstParameter' not found on type '[S.P.CoreLib]System.Delegate'

    This means that you are using mismatched versions of CoreLib and the compiler. You either need to build the runtime from the point the repro was created, or patch the runtime binaries in the repro.

  16. rmarinho commented on Mar 25, 2024

    @rmarinho
    Member

    Seeems we need to test this actually fixes the issue #100220

  17. rolfbjarne commented on Apr 5, 2024

    @rolfbjarne
    MemberAuthor

    @EgorBo any updates on this?

  18. EgorBo commented on Apr 5, 2024

    @EgorBo
    Member

    @EgorBo any updates on this?

    Sorry, was busy with internal things. I am not sure I understand why my revert #100147 was closed - it was supposed to revert the PR that uncovered this bug untill proper fix is landed into main. In order to unblock you. I am looking into it now

  19. rmarinho commented on Apr 8, 2024

    @rmarinho
    Member

    This is blocking us from merging also new android versions of net9 on .net maui since they bump to preview4. Can we get some priority on this please?

    Thanks

  20. EgorBo commented on Apr 8, 2024

    @EgorBo
    Member

    #100289 is waiting for a review
    Like I said, #100147 could be used to unblock (was closed by @lewing) you.

  21. rolfbjarne commented on Apr 15, 2024

    @rolfbjarne
    MemberAuthor

    Looks like this has been fixed now, so I guess this can be closed?

  22. MichalStrehovsky commented on Apr 15, 2024

    @MichalStrehovsky
    Member

    Yup, doesn't look like any other work to do. Resolved with #100220.

  23. locked and limited conversation to collaborators on May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclr

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions