Skip to content

Get rid of TemplateConstructableTypes #82384

@MichalStrehovsky

Description

@MichalStrehovsky

While looking at a repro case with Linq.Parallel, I'm seeing we're spending significant amount of time in this method. Basically, whenever I break into the debugger at random intervals, stack looks like below.

It feels like TemplateConstructableTypes is just us saying "describing the dependencies of the individual native layout nodes is hard".

There's some context in dotnet/corert@cc4c035, dotnet/corert@1dc677b, and dotnet/corert#4860.

I think we can do better.

Of course fixing this is going to be risky and probably introduce regressions. It's probably worth it.

 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type)	C#
>	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NodeFactory.NativeLayoutHelper.TemplateConstructableTypes(Internal.TypeSystem.TypeDesc type) Line 244	C#
 	ILCompiler.Compiler.dll!ILCompiler.DependencyAnalysis.NativeLayoutTemplateTypeLayoutVertexNode.GetStaticDependencies(ILCompiler.DependencyAnalysis.NodeFactory context) Line 968	C#

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-coreclrin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions