// The .NET Foundation licenses this file to you under the MIT license.
using System;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
public ReadyToRunSymbolNodeFactory SymbolNodeFactory { get; }
public ReadyToRunCompilationModuleGroupBase CompilationModuleGroup { get; }
private readonly int? _customPESectionAlignment;
+ /// <summary>
+ /// Determining whether a type's layout is fixed is a little expensive and the question can be asked many times
+ /// for the same type during compilation so preserve the computed value.
+ /// </summary>
+ private ConcurrentDictionary<TypeDesc, bool> _computedFixedLayoutTypes = new ConcurrentDictionary<TypeDesc, bool>();
internal ReadyToRunCodegenCompilation(
DependencyAnalyzerBase<NodeFactory> dependencyGraph,
}
}
- public bool IsLayoutFixedInCurrentVersionBubble(TypeDesc type)
+ private bool IsLayoutFixedInCurrentVersionBubbleInternal(TypeDesc type)
{
// Primitive types and enums have fixed layout
if (type.IsPrimitive || type.IsEnum)
return true;
}
+ public bool IsLayoutFixedInCurrentVersionBubble(TypeDesc type) =>
+ _computedFixedLayoutTypes.GetOrAdd(type, (t) => IsLayoutFixedInCurrentVersionBubbleInternal(t));
+
public bool IsInheritanceChainLayoutFixedInCurrentVersionBubble(TypeDesc type)
{
// This method is not expected to be called for value types
<ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/clr-x64-JIT/v4.0/devdiv374539/DevDiv_374539/*">
<Issue>https://github.com/dotnet/runtime/issues/32732</Issue>
</ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b399444/**/*">
- <Issue>https://github.com/dotnet/runtime/issues/38259</Issue>
- </ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/CLR-x86-JIT/v2.1/DDB/B168384/LdfldaHack/*">
<Issue>https://github.com/dotnet/runtime/issues/615</Issue>
</ExcludeList>