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
11 changes: 10 additions & 1 deletion src/coreclr/tools/Common/Compiler/EventPseudoDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,16 @@ public EventPseudoDesc(EcmaType type, EventDefinitionHandle handle)

public override string ToString() => $"{_type}.{Name}";

public static bool operator ==(EventPseudoDesc a, EventPseudoDesc b) => a._type == b._type && a._handle == b._handle;
public static bool operator ==(EventPseudoDesc a, EventPseudoDesc b)
{
if (a is null)
return b is null;

if (b is null)
return false;

return a._type == b._type && a._handle == b._handle;
}

public static bool operator !=(EventPseudoDesc a, EventPseudoDesc b) => !(a == b);
}
Expand Down
11 changes: 10 additions & 1 deletion src/coreclr/tools/Common/Compiler/PropertyPseudoDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,16 @@ public PropertyPseudoDesc(EcmaType type, PropertyDefinitionHandle handle)

public override string ToString() => $"{_type}.{Name}";

public static bool operator ==(PropertyPseudoDesc a, PropertyPseudoDesc b) => a._type == b._type && a._handle == b._handle;
public static bool operator ==(PropertyPseudoDesc a, PropertyPseudoDesc b)
{
if (a is null)
return b is null;

if (b is null)
return false;

return a._type == b._type && a._handle == b._handle;
}

public static bool operator !=(PropertyPseudoDesc a, PropertyPseudoDesc b) => !(a == b);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public ModuleAndIntValueKey(int integer, EcmaModule module)
Module = module;
}

public bool Equals(ModuleAndIntValueKey other) => IntValue == other.IntValue && ((Module == null && other.Module == null) || Module.Equals(other.Module));
public bool Equals(ModuleAndIntValueKey other) => IntValue == other.IntValue && Module == other.Module;
public override bool Equals(object obj) => obj is ModuleAndIntValueKey && Equals((ModuleAndIntValueKey)obj);
public override int GetHashCode()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,20 +633,6 @@ public Import GenericLookupHelper(
(MethodWithToken)helperArgument,
methodContext);

case ReadyToRunHelperId.MethodDictionary:
return GenericLookupMethodHelper(
runtimeLookupKind,
ReadyToRunFixupKind.MethodHandle,
(MethodWithToken)helperArgument,
methodContext);

case ReadyToRunHelperId.TypeDictionary:
return GenericLookupTypeHelper(
runtimeLookupKind,
ReadyToRunFixupKind.TypeDictionary,
(TypeDesc)helperArgument,
methodContext);

case ReadyToRunHelperId.VirtualDispatchCell:
return GenericLookupMethodHelper(
runtimeLookupKind,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,14 @@ public bool IsInheritanceChainLayoutFixedInCurrentVersionBubble(TypeDesc type)
if (CompilationModuleGroup.TypeLayoutCompilationUnits(type).HasMultipleInexactCompilationUnits)
return false;

while (!type.IsObject && type != null)
while (!type.IsObject)
{
if (!IsLayoutFixedInCurrentVersionBubble(type))
{
return false;
}
type = type.BaseType;
Debug.Assert(type != null);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Threading;

using Debug = System.Diagnostics.Debug;

namespace Internal.TypeSystem.Ecma
{
partial class MutableModule
{
// This isn't deterministic, but it is functional. At this time, since only 1 MutableModule is contained in a build, it will be deterministic as it will always return 0.
static int s_globalIndex = 0;

int _index = Interlocked.Increment(ref s_globalIndex);
// There is only ever a single MutableModule in a build, so any comparison is against itself.
public int CompareTo(MutableModule other)
{
return _index.CompareTo(_index);
Debug.Assert(this == other);
return 0;
}
}
}