Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>2021-05-21 21:35:06 +0300
committerGitHub <noreply@github.com>2021-05-21 21:35:06 +0300
commit1e388cd5aa1ef4fec79ab4bf39520e7dd252c6d1 (patch)
treecc79964c82f929dacb309bf219bd4486675d6515 /src/coreclr/tools
parent12a5044232bbfc1bc803bac58216f314dbdf3c92 (diff)
Override BaseType in TypeRefTypeSystemType (#52963)
* Override BaseType in TypeRefTypeSystemType BaseType is being used to determine whether the type is a value type or class type. This meant that `dotnet-pgo merge` would always produce metadata saying that all types were class types. In practice, this meant that we had the following behavior: ``` .\dotnet-pgo.exe merge --input IBCTrace28800.mibc --output identity.mibc .\dotnet-pgo.exe merge --input IBCTrace28800.mibc --input identity.mibc --output foo.mibc Opening D:\dev\dotnet\dotnet-optimization\output\temp\IBCTrace28800.mibc Opening D:\dev\dotnet\runtime\artifacts\bin\coreclr\windows.x64.Debug\dotnet-pgo\foo.mibc Unhandled exception. System.Exception: Same type `[S.P.CoreLib]System.ReadOnlySpan`1` used as both ValueType and non-ValueType at Microsoft.Diagnostics.Tools.Pgo.TypeRefTypeSystem.TypeRefTypeSystemType.SetIsValueType(Boolean isValueType) at Microsoft.Diagnostics.Tools.Pgo.TypeRefTypeSystem.TypeRefTypeSystemContext.TypeRefSignatureParserProvider.GetTypeFromReference(MetadataReader reader, TypeReferenceHandle handle, Byte rawTypeKind) ``` The same problem would occur when using compare-mibc to compare a merged mibc file with some of its constituents. These scenarios work now. * Re-abstract BaseType in MetadataType
Diffstat (limited to 'src/coreclr/tools')
-rw-r--r--src/coreclr/tools/Common/TypeSystem/Common/MetadataType.cs3
-rw-r--r--src/coreclr/tools/dotnet-pgo/TypeRefTypeSystem/TypeRefTypeSystemType.cs2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/MetadataType.cs b/src/coreclr/tools/Common/TypeSystem/Common/MetadataType.cs
index 061fca6790c..72b0aeadba8 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/MetadataType.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/MetadataType.cs
@@ -60,6 +60,9 @@ namespace Internal.TypeSystem
/// </summary>
public abstract MetadataType MetadataBaseType { get; }
+ // Make sure children remember to override both MetadataBaseType and BaseType.
+ public abstract override DefType BaseType { get; }
+
/// <summary>
/// If true, the type cannot be used as a base type of any other type.
/// </summary>
diff --git a/src/coreclr/tools/dotnet-pgo/TypeRefTypeSystem/TypeRefTypeSystemType.cs b/src/coreclr/tools/dotnet-pgo/TypeRefTypeSystem/TypeRefTypeSystemType.cs
index cb94b02ebe9..6b5689805e9 100644
--- a/src/coreclr/tools/dotnet-pgo/TypeRefTypeSystem/TypeRefTypeSystemType.cs
+++ b/src/coreclr/tools/dotnet-pgo/TypeRefTypeSystem/TypeRefTypeSystemType.cs
@@ -151,6 +151,8 @@ namespace Microsoft.Diagnostics.Tools.Pgo.TypeRefTypeSystem
public override ModuleDesc Module => _module;
+ public override DefType BaseType => MetadataBaseType;
+
public override MetadataType MetadataBaseType
{
get