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

ILC crashes on x64, works on arm64 #99611

Closed
rolfbjarne opened this issue Mar 12, 2024 · 17 comments
Closed

ILC crashes on x64, works on arm64 #99611

rolfbjarne opened this issue Mar 12, 2024 · 17 comments
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@rolfbjarne
Copy link
Member

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 (xamarin/xamarin-macios#20249).

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

Known Workarounds

Use an Intel Mac.

Configuration

No response

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 12, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Mar 12, 2024
@rolfbjarne
Copy link
Member Author

CC @MichalStrehovsky

@EgorBo
Copy link
Member

EgorBo commented Mar 12, 2024

Looks like it could be caused by #99140

@EgorBo EgorBo self-assigned this Mar 12, 2024
@EgorBo EgorBo removed the untriaged New issue has not been triaged by the area owner label Mar 12, 2024
@EgorBo EgorBo added this to the 9.0.0 milestone Mar 12, 2024
@EgorBo
Copy link
Member

EgorBo commented Mar 12, 2024

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) 🤔

@EgorBo
Copy link
Member

EgorBo commented Mar 12, 2024

@rolfbjarne I presume it happens on Rosetta, right?

@EgorBo
Copy link
Member

EgorBo commented Mar 12, 2024

@rolfbjarne I presume it happens on Rosetta, right?

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

@rolfbjarne
Copy link
Member Author

@rolfbjarne I presume it happens on Rosetta, right?

Both Rosetta and Intel macs.

@rolfbjarne
Copy link
Member Author

@EgorBo any updates on this?

@steveisok
Copy link
Member

/cc @agocke

@EgorBo
Copy link
Member

EgorBo commented Mar 22, 2024

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

@jkotas
Copy link
Member

jkotas commented Mar 22, 2024

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.

@rmarinho
Copy link
Member

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

@rolfbjarne
Copy link
Member Author

@EgorBo any updates on this?

@EgorBo
Copy link
Member

EgorBo commented Apr 5, 2024

@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

@rmarinho
Copy link
Member

rmarinho commented Apr 8, 2024

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

@EgorBo
Copy link
Member

EgorBo commented Apr 8, 2024

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

@rolfbjarne
Copy link
Member Author

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

@MichalStrehovsky
Copy link
Member

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

@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

No branches or pull requests

6 participants