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

crossgen2 asserts: "OwningType == other.OwningType" in MethodWithToken.CompareTo #61732

Closed
EgorBo opened this issue Nov 17, 2021 · 5 comments · Fixed by #87353
Closed

crossgen2 asserts: "OwningType == other.OwningType" in MethodWithToken.CompareTo #61732

EgorBo opened this issue Nov 17, 2021 · 5 comments · Fixed by #87353
Assignees
Milestone

Comments

@EgorBo
Copy link
Member

EgorBo commented Nov 17, 2021

I'm trying to prejitt the latest version of PowerShell in R2R-Composite mode with mibc data and at some point it asserts here:

the types in that asserts are:

{[Microsoft.CodeAnalysis.CSharp]Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2+ILocalState<Microsoft.CodeAnalysis.CSharp.NullableWalker+LocalState,Microsoft.CodeAnalysis.CSharp.NullableWalker+LocalFunctionState>}
!=
{[Microsoft.CodeAnalysis.CSharp]Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2+ILocalState<Microsoft.CodeAnalysis.CSharp.NullableWalker+LocalState,System.__Canon>}

Steps to reproduce

  1. Build https://github.com/PowerShell/PowerShell locally, it should be just:
Import-Module ./build.psm1
Start-PSBootstrap
Start-PSBuild --configuration Release
  1. Collect mibc data for a scenario where you only execute pwsh.exe HelloWorld.ps1 where HelloWorld.ps1 is just Write-Host "Hello, World!" or use my ps.mibc (here)
  2. Try to prejit it using this command:
crossgen2.exe --targetos:windows --targetarch:x64 --embed-pgo-data --mibc:ps.mibc --Ot
 --composite --out:"C:\PS\pwsh.r2r.dll" C:\prj\PS\*.dll

Expected:

pwsh.r2r.dll is successfully emitted

Actual:

Process terminated. Assertion failed.
   at Internal.JitInterface.MethodWithToken.CompareTo(MethodWithToken other, TypeSystemComparer comparer) in C:\prj\runtime\src\coreclr\tools\aot\ILCompiler.ReadyToRun\JitInterface\CorInfoImpl.ReadyToRun.cs:line 300
   at ILCompiler.DependencyAnalysis.ReadyToRun.MethodFixupSignature.CompareToImpl(ISortableNode other, CompilerComparer comparer) in C:\prj\runtime\src\coreclr\tools\aot\ILCompiler.ReadyToRun\Compiler\DependencyAnalysis\ReadyToRun\MethodFixupSignature.cs:line 143
   at ILCompiler.DependencyAnalysis.SortableDependencyNode.ObjectNodeComparer.Compare(DependencyNodeCore`1 x1, DependencyNodeCore`1 y1) in C:\prj\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\SortableDependencyNode.cs:line 147
   at ILCompiler.Sorting.Implementation.MergeSortCore`5.Merge(T[] localCopyOfHalfOfArray, TDataStructure arrayToSort, Int32 index, Int32 halfLen, Int32 length, TComparer comparer) in C:\prj\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 89
   at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in C:\prj\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 49
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
   at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
   at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in C:\prj\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51

It also crashes on Release version of .NET 6.0

PS: Checked JIT might assert like this #61705 but that assert can be removed/ignored for this issue.

@dotnet-issue-labeler dotnet-issue-labeler bot added area-crossgen2-coreclr untriaged New issue has not been triaged by the area owner labels Nov 17, 2021
@AndyAyersMS
Copy link
Member

FYI @daxian-dbw in case you run into this too.

@EgorBo
Copy link
Member Author

EgorBo commented Nov 17, 2021

With Release version of jit/crossgen it crashes with

Failed to create CoreCLR, HRESULT: 0x80070002

@trylek trylek removed the untriaged New issue has not been triaged by the area owner label Jun 15, 2022
@trylek trylek added this to the 7.0.0 milestone Jun 15, 2022
@mangod9
Copy link
Member

mangod9 commented Jul 19, 2022

@EgorBo is this something we are tracking for 7?

@EgorBo
Copy link
Member Author

EgorBo commented Jul 19, 2022

@EgorBo is this something we are tracking for 7?

I think we can move it to 8.0 this, afaik it's Debug-only assert.

@mangod9 mangod9 modified the milestones: 7.0.0, 8.0.0 Jul 19, 2022
@trylek trylek mentioned this issue May 3, 2023
46 tasks
@davidwrighton davidwrighton self-assigned this Jun 9, 2023
@davidwrighton
Copy link
Member

This was fixed for .NET 7 as part of #71271, but it still fails in debug builds due to name mangling duplication. I'm putting a fix together for that for .NET 8.

@davidwrighton davidwrighton linked a pull request Jun 9, 2023 that will close this issue
@ghost ghost locked as resolved and limited conversation to collaborators Jul 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants