Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -5,13 +5,13 @@

namespace Internal.IL.Stubs
{
public partial class ValueTypeGetFieldHelperMethodOverride
public partial class GetFieldHelperMethodOverride
{
protected override int ClassCode => 2036839816;

protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (ValueTypeGetFieldHelperMethodOverride)other;
var otherMethod = (GetFieldHelperMethodOverride)other;

return comparer.Compare(_owningType, otherMethod._owningType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ namespace Internal.IL.Stubs
/// into all value types that cannot have their Equals(object) and GetHashCode() methods operate on individual
/// bytes. The purpose of the override is to provide access to the value types' fields and their types.
/// </summary>
public sealed partial class ValueTypeGetFieldHelperMethodOverride : SpecializableILStubMethod
public sealed partial class GetFieldHelperMethodOverride : SpecializableILStubMethod
{
private MetadataType _owningType;
private MethodSignature _signature;

internal ValueTypeGetFieldHelperMethodOverride(MetadataType owningType)
internal GetFieldHelperMethodOverride(MetadataType owningType)
{
_owningType = owningType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public partial class CompilerTypeSystemContext
private MethodDesc _objectEqualsMethod;
private MetadataType _iAsyncStateMachineType;

private sealed class ValueTypeMethodHashtable : LockFreeReaderHashtable<MetadataType, MethodDesc>
private sealed class GetFieldMethodHashtable : LockFreeReaderHashtable<MetadataType, MethodDesc>
{
protected override int GetKeyHashCode(MetadataType key) => key.GetHashCode();
protected override int GetValueHashCode(MethodDesc value) => value.OwningType.GetHashCode();
Expand All @@ -25,19 +25,19 @@ private sealed class ValueTypeMethodHashtable : LockFreeReaderHashtable<Metadata

protected override MethodDesc CreateValueFromKey(MetadataType key)
{
return new ValueTypeGetFieldHelperMethodOverride(key);
return new GetFieldHelperMethodOverride(key);
}
}

private ValueTypeMethodHashtable _valueTypeMethodHashtable = new ValueTypeMethodHashtable();
private GetFieldMethodHashtable _getFieldMethodHashtable = new GetFieldMethodHashtable();

protected virtual IEnumerable<MethodDesc> GetAllMethodsForValueType(TypeDesc valueType, bool virtualOnly)
{
TypeDesc valueTypeDefinition = valueType.GetTypeDefinition();

if (RequiresValueTypeGetFieldHelperMethod((MetadataType)valueTypeDefinition))
{
MethodDesc getFieldHelperMethod = _valueTypeMethodHashtable.GetOrCreateValue((MetadataType)valueTypeDefinition);
MethodDesc getFieldHelperMethod = _getFieldMethodHashtable.GetOrCreateValue((MetadataType)valueTypeDefinition);

if (valueType != valueTypeDefinition)
{
Expand All @@ -60,7 +60,7 @@ protected virtual IEnumerable<MethodDesc> GetAllMethodsForAttribute(TypeDesc att

if (RequiresAttributeGetFieldHelperMethod(attributeTypeDefinition))
{
MethodDesc getFieldHelperMethod = _valueTypeMethodHashtable.GetOrCreateValue((MetadataType)attributeTypeDefinition);
MethodDesc getFieldHelperMethod = _getFieldMethodHashtable.GetOrCreateValue((MetadataType)attributeTypeDefinition);

if (attributeType != attributeTypeDefinition)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ private void OutputVirtualSlots(NodeFactory factory, ref ObjectDataBuilder objDa
if (isAsyncStateMachineValueType)
{
if ((declType.IsObject && (declMethod.Name.SequenceEqual("Equals"u8) || declMethod.Name.SequenceEqual("GetHashCode"u8)) && implMethod.OwningType.IsWellKnownType(WellKnownType.ValueType))
|| (declType.IsWellKnownType(WellKnownType.ValueType) && declMethod.Name.SequenceEqual(ValueTypeGetFieldHelperMethodOverride.MetadataName)))
|| (declType.IsWellKnownType(WellKnownType.ValueType) && declMethod.Name.SequenceEqual(GetFieldHelperMethodOverride.MetadataName)))
{
shouldEmitImpl = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override bool IsBlocked(MethodDesc method)
return true;

// Also don't expose the ValueType.__GetFieldOverride method.
if (ecmaMethod.Name.SequenceEqual(Internal.IL.Stubs.ValueTypeGetFieldHelperMethodOverride.MetadataName)
if (ecmaMethod.Name.SequenceEqual(Internal.IL.Stubs.GetFieldHelperMethodOverride.MetadataName)
&& ecmaMethod.OwningType.IsWellKnownType(WellKnownType.ValueType))
return true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public bool CanFold(MethodDesc method)
if (!_genericsOnly || method.HasInstantiation || method.OwningType.HasInstantiation)
return true;

if (method.GetTypicalMethodDefinition() is ValueTypeGetFieldHelperMethodOverride)
if (method.GetTypicalMethodDefinition() is GetFieldHelperMethodOverride)
return true;

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
<Compile Include="..\..\Common\TypeSystem\IL\Stubs\StructMarshallingThunk.Sorting.cs">
<Link>IL\Stubs\StructMarshallingThunk.Sorting.cs</Link>
</Compile>
<Compile Include="..\..\Common\TypeSystem\IL\Stubs\ValueTypeGetFieldHelperMethodOverride.cs">
<Link>IL\Stubs\ValueTypeGetFieldHelperMethodOverride.cs</Link>
<Compile Include="..\..\Common\TypeSystem\IL\Stubs\GetFieldHelperMethodOverride.cs">
<Link>IL\Stubs\GetFieldHelperMethodOverride.cs</Link>
</Compile>
<Compile Include="..\..\Common\TypeSystem\IL\Stubs\ValueTypeGetFieldHelperMethodOverride.Sorting.cs">
<Link>IL\Stubs\ValueTypeGetFieldHelperMethodOverride.Sorting.cs</Link>
<Compile Include="..\..\Common\TypeSystem\IL\Stubs\GetFieldHelperMethodOverride.Sorting.cs">
<Link>IL\Stubs\GetFieldHelperMethodOverride.Sorting.cs</Link>
</Compile>
<Compile Include="..\..\Common\TypeSystem\Interop\IL\InlineArrayType.Sorting.cs">
<Link>TypeSystem\Interop\IL\InlineArrayType.Sorting.cs</Link>
Expand Down Expand Up @@ -397,7 +397,7 @@
<Compile Include="Compiler\CompilerTypeSystemContext.GeneratedAssembly.cs" />
<Compile Include="Compiler\CompilerTypeSystemContext.GeneratedAssembly.Sorting.cs" />
<Compile Include="Compiler\CompilerTypeSystemContext.EnumMethods.cs" />
<Compile Include="Compiler\CompilerTypeSystemContext.ValueTypeMethods.cs" />
<Compile Include="Compiler\CompilerTypeSystemContext.GetFieldMethodOverrides.cs" />
<Compile Include="Compiler\CompilerGeneratedInteropStubManager.cs" />
<Compile Include="Compiler\CustomAttributeExtensions.cs" />
<Compile Include="Compiler\Dataflow\ArrayValue.cs" />
Expand Down
Loading