Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static PropertyPseudoDesc GetProperty(this MetadataType mdType, string na
}
}

mdType = mdType.MetadataBaseType;
mdType = mdType.BaseType;
if (mdType != null)
return GetProperty(mdType, name, signature);

Expand Down
14 changes: 7 additions & 7 deletions src/coreclr/tools/Common/Compiler/EventPseudoDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ public class EventPseudoDesc : TypeSystemEntity

private EventDefinition Definition => _type.MetadataReader.GetEventDefinition(_handle);

public MethodDesc AddMethod
public EcmaMethod AddMethod
{
get
{
MethodDefinitionHandle adder = Definition.GetAccessors().Adder;
return adder.IsNil ? null : _type.EcmaModule.GetMethod(adder);
return adder.IsNil ? null : _type.Module.GetMethod(adder);
}
}

public MethodDesc RemoveMethod
public EcmaMethod RemoveMethod
{
get
{
MethodDefinitionHandle setter = Definition.GetAccessors().Remover;
return setter.IsNil ? null : _type.EcmaModule.GetMethod(setter);
return setter.IsNil ? null : _type.Module.GetMethod(setter);
}
}

public MethodDesc RaiseMethod
public EcmaMethod RaiseMethod
{
get
{
MethodDefinitionHandle raiser = Definition.GetAccessors().Raiser;
return raiser.IsNil ? null : _type.EcmaModule.GetMethod(raiser);
return raiser.IsNil ? null : _type.Module.GetMethod(raiser);
}
}

Expand All @@ -55,7 +55,7 @@ public CustomAttributeHandleCollection GetCustomAttributes
}
}

public MetadataType OwningType
public EcmaType OwningType
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public GraphBuilder(EcmaModule assembly)
{
try
{
var ecmaType = (EcmaType)assembly.GetObject(typeHandle);
var ecmaType = assembly.GetType(typeHandle);
WalkAncestorTypes(ecmaType);
}
catch (TypeSystemException)
Expand All @@ -198,7 +198,7 @@ public GraphBuilder(EcmaModule assembly)
{
try
{
var ecmaMethod = (EcmaMethod)assembly.GetObject(methodHandle);
var ecmaMethod = assembly.GetMethod(methodHandle);
WalkMethod(ecmaMethod);

if (ecmaMethod.IsVirtual)
Expand All @@ -218,7 +218,7 @@ public GraphBuilder(EcmaModule assembly)
{
try
{
var ecmaField = (EcmaField)assembly.GetObject(fieldHandle);
var ecmaField = assembly.GetField(fieldHandle);

if (typeContext.IsNull)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public bool IsDeepPossiblyCyclicInstantiation(MethodDesc method)

private bool FormsCycle(TypeSystemEntity entity, out ModuleCycleInfo cycleInfo)
{
EcmaModule ownerModule = (entity as EcmaType)?.EcmaModule ?? (entity as EcmaMethod)?.Module;
EcmaModule ownerModule = (entity as EcmaType)?.Module ?? (entity as EcmaMethod)?.Module;
if (ownerModule != null)
{
cycleInfo = _hashtable.GetOrCreateValue(ownerModule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static string GetHardwareIntrinsicId(TargetArchitecture architecture, Typ
if (potentialType.Name.SequenceEqual("X64"u8) || potentialType.Name.SequenceEqual("Arm64"u8))
{
if (architecture is TargetArchitecture.X64 or TargetArchitecture.ARM64)
potentialType = (MetadataType)potentialType.ContainingType;
potentialType = potentialType.ContainingType;
else
return "";
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private string ComputeMangledTypeName(TypeDesc type)
{
if (type is EcmaType ecmaType)
{
string assemblyName = ((EcmaAssembly)ecmaType.EcmaModule).GetName().Name;
string assemblyName = ((EcmaAssembly)ecmaType.Module).GetName().Name;
bool isSystemPrivate = assemblyName.StartsWith("System.Private.");

// Abbreviate System.Private to S.P. This might conflict with user defined assembly names,
Expand All @@ -190,7 +190,7 @@ private string ComputeMangledTypeName(TypeDesc type)

if (!_mangledTypeNames.ContainsKey(type))
{
foreach (MetadataType t in ecmaType.EcmaModule.GetAllTypes())
foreach (MetadataType t in ecmaType.Module.GetAllTypes())
{
string name = t.GetFullName();

Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/tools/Common/Compiler/PropertyPseudoDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ public class PropertyPseudoDesc : TypeSystemEntity
private PropertyDefinition Definition => _type.MetadataReader.GetPropertyDefinition(_handle);

public PropertySignature Signature =>
new EcmaSignatureParser(_type.EcmaModule, _type.MetadataReader.GetBlobReader(Definition.Signature), NotFoundBehavior.Throw)
new EcmaSignatureParser(_type.Module, _type.MetadataReader.GetBlobReader(Definition.Signature), NotFoundBehavior.Throw)
.ParsePropertySignature();

public MethodDesc GetMethod
public EcmaMethod GetMethod
{
get
{
MethodDefinitionHandle getter = Definition.GetAccessors().Getter;
return getter.IsNil ? null : _type.EcmaModule.GetMethod(getter);
return getter.IsNil ? null : _type.Module.GetMethod(getter);
}
}

public MethodDesc SetMethod
public EcmaMethod SetMethod
{
get
{
MethodDefinitionHandle setter = Definition.GetAccessors().Setter;
return setter.IsNil ? null : _type.EcmaModule.GetMethod(setter);
return setter.IsNil ? null : _type.Module.GetMethod(setter);
}
}

Expand All @@ -50,7 +50,7 @@ public CustomAttributeHandleCollection GetCustomAttributes
}
}

public MetadataType OwningType
public EcmaType OwningType
{
get
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/tools/Common/Compiler/PseudoDescExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static PropertyPseudoDesc GetPropertyForAccessor(this MethodDesc accessor
if (!accessor.IsSpecialName || accessor.GetTypicalMethodDefinition() is not EcmaMethod ecmaAccessor)
return null;

var type = (EcmaType)ecmaAccessor.OwningType;
var type = ecmaAccessor.OwningType;
var reader = type.MetadataReader;
foreach (var propertyHandle in reader.GetTypeDefinition(type.Handle).GetProperties())
{
Expand All @@ -35,7 +35,7 @@ public static EventPseudoDesc GetEventForAccessor(this MethodDesc accessor)
if (!accessor.IsSpecialName || accessor.GetTypicalMethodDefinition() is not EcmaMethod ecmaAccessor)
return null;

var type = (EcmaType)ecmaAccessor.OwningType;
var type = ecmaAccessor.OwningType;
var reader = type.MetadataReader;
foreach (var eventHandle in reader.GetTypeDefinition(type.Handle).GetEvents())
{
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2334,7 +2334,7 @@ private int GatherClassGCLayout(MetadataType type, byte* gcPtrs)
{
int result = 0;

if (type.MetadataBaseType is { ContainsGCPointers: true } baseType)
if (type.BaseType is { ContainsGCPointers: true } baseType)
result += GatherClassGCLayout(baseType, gcPtrs);

bool isInlineArray = type.IsInlineArray;
Expand Down Expand Up @@ -3443,7 +3443,7 @@ private static string getMethodNameFromMetadataImpl(MethodDesc method, out strin

if (method.GetTypicalMethodDefinition() is EcmaMethod ecmaMethod)
{
EcmaType owningType = (EcmaType)ecmaMethod.OwningType;
EcmaType owningType = ecmaMethod.OwningType;
var reader = owningType.MetadataReader;

if (className != null)
Expand All @@ -3456,7 +3456,7 @@ private static string getMethodNameFromMetadataImpl(MethodDesc method, out strin
EcmaType containingType = owningType;
for (nuint i = 0; i < maxEnclosingClassNames; i++)
{
containingType = containingType.ContainingType as EcmaType;
containingType = containingType.ContainingType;
if (containingType == null)
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite
string nestedTypeName = null;
while (metadataType.ContainingType != null)
{
var enclosingType = (MetadataType)metadataType.ContainingType;
var enclosingType = metadataType.ContainingType;
namespaceName = enclosingType.GetNamespace();
nestedTypeName = nestedTypeName is null ? metadataType.GetName() : $"{metadataType.GetName()}_{nestedTypeName}";
typeName = enclosingType.GetName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite
string nestedTypeName = null;
while (metadataType.ContainingType != null)
{
var enclosingType = (MetadataType)metadataType.ContainingType;
var enclosingType = metadataType.ContainingType;
namespaceName = enclosingType.GetNamespace();
nestedTypeName = nestedTypeName is null ? metadataType.GetName() : $""{metadataType.GetName()}_{nestedTypeName}"";
typeName = enclosingType.GetName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ protected override MethodImplRecord[] ComputeVirtualMethodImplsForType()
return Array.Empty<MethodImplRecord>();
}

public override MetadataType MetadataBaseType => (MetadataType)BaseType;

public override DefType[] ExplicitlyImplementedInterfaces => Array.Empty<DefType>();

public override bool IsAbstract => false;
Expand Down
14 changes: 9 additions & 5 deletions src/coreclr/tools/Common/TypeSystem/Canon/CanonTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

using Debug = System.Diagnostics.Debug;

#if TYPE_LOADER_IMPLEMENTATION
using MetadataType = Internal.TypeSystem.DefType;
#endif

namespace Internal.TypeSystem
{
/// <summary>
Expand Down Expand Up @@ -51,7 +55,7 @@ public sealed override TypeSystemContext Context
}
}

public override DefType ContainingType => null;
public override MetadataType ContainingType => null;
}

/// <summary>
Expand Down Expand Up @@ -87,11 +91,11 @@ public CanonType(TypeSystemContext context)
// consumer-specific initialization.
partial void Initialize();

public override DefType BaseType
public override MetadataType BaseType
{
get
{
return Context.GetWellKnownType(WellKnownType.Object);
return (MetadataType)Context.GetWellKnownType(WellKnownType.Object);
}
}

Expand Down Expand Up @@ -171,12 +175,12 @@ public UniversalCanonType(TypeSystemContext context)
// consumer-specific initialization.
partial void Initialize();

public override DefType BaseType
public override MetadataType BaseType
{
get
{
// UniversalCanon is "a struct of indeterminate size and GC layout"
return Context.GetWellKnownType(WellKnownType.ValueType);
return (MetadataType)Context.GetWellKnownType(WellKnownType.ValueType);
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/tools/Common/TypeSystem/Common/FieldDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

using Debug = System.Diagnostics.Debug;

#if TYPE_LOADER_IMPLEMENTATION
using MetadataType = Internal.TypeSystem.DefType;
#endif

namespace Internal.TypeSystem
{
public abstract partial class FieldDesc : TypeSystemEntity
Expand Down Expand Up @@ -45,7 +49,7 @@ public string GetName()
);
}

public abstract DefType OwningType
public abstract MetadataType OwningType
{
get;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
using System;
using Debug = System.Diagnostics.Debug;

#if TYPE_LOADER_IMPLEMENTATION
using MetadataType = Internal.TypeSystem.DefType;
#endif

namespace Internal.TypeSystem
{
public sealed partial class FieldForInstantiatedType : FieldDesc
Expand All @@ -26,7 +30,7 @@ public override TypeSystemContext Context
}
}

public override DefType OwningType
public override MetadataType OwningType
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ public sealed partial class ImpliedRepeatedFieldDesc : FieldDesc
{
private readonly FieldDesc _underlyingFieldDesc;

public ImpliedRepeatedFieldDesc(DefType owningType, FieldDesc underlyingFieldDesc, int fieldIndex)
public ImpliedRepeatedFieldDesc(MetadataType owningType, FieldDesc underlyingFieldDesc, int fieldIndex)
{
OwningType = owningType;
_underlyingFieldDesc = underlyingFieldDesc;
FieldIndex = fieldIndex;
}

public override DefType OwningType { get; }
public override MetadataType OwningType { get; }

public override TypeDesc FieldType => _underlyingFieldDesc.FieldType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ namespace Internal.TypeSystem
{
public sealed partial class InstantiatedType : MetadataType
{
public override MetadataType MetadataBaseType
{
get
{
if (_baseType == this)
return InitializeBaseType();
return _baseType;
}
}

// Properties that are passed through from the type definition
public override ClassLayoutMetadata GetClassLayout()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private MetadataType InitializeBaseType()
return (_baseType = (uninst != null) ? (MetadataType)uninst.InstantiateSignature(_instantiation, default(Instantiation)) : null);
}

public override DefType BaseType
public override MetadataType BaseType
{
get
{
Expand Down Expand Up @@ -297,7 +297,7 @@ public override TypeDesc GetTypeDefinition()
return _typeDef;
}

public override DefType ContainingType
public override MetadataType ContainingType
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public override ComputedInstanceFieldLayout ComputeInstanceLayout(DefType defTyp
ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadBadFormat, type);
}

MetadataType baseType = type.MetadataBaseType;
MetadataType baseType = type.BaseType;
if (!baseType.IsObject && baseType.IsAutoLayout)
{
ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadBadFormat, type);
Expand Down
Loading
Loading