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 @@ -49,12 +49,6 @@ public uint NumStandardEntries
{
return _standardEntryCount;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
_standardEntryCount = checked((ushort)value);
}
#endif
}

public uint NumDefaultEntries
Expand All @@ -63,12 +57,6 @@ public uint NumDefaultEntries
{
return _defaultEntryCount;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
_defaultEntryCount = checked((ushort)value);
}
#endif
}

public uint NumStandardStaticEntries
Expand All @@ -77,12 +65,6 @@ public uint NumStandardStaticEntries
{
return _standardStaticEntryCount;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
_standardStaticEntryCount = checked((ushort)value);
}
#endif
}

public uint NumDefaultStaticEntries
Expand All @@ -91,12 +73,6 @@ public uint NumDefaultStaticEntries
{
return _defaultStaticEntryCount;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
_defaultStaticEntryCount = checked((ushort)value);
}
#endif
}

public int Size
Expand Down Expand Up @@ -182,21 +158,6 @@ internal bool HasComponentSize
// return (_uFlags & (uint)EETypeFlags.HasComponentSizeFlag) != 0;
return (int)_uFlags < 0;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
if (value)
{
Debug.Assert(ExtendedFlags == 0);
_uFlags |= (uint)EETypeFlags.HasComponentSizeFlag;
}
else
{
// we should not be un-setting this bit.
Debug.Assert(!HasComponentSize);
}
}
#endif
}

internal ushort ComponentSize
Expand All @@ -209,7 +170,7 @@ internal ushort ComponentSize
set
{
Debug.Assert(HasComponentSize);
_uFlags |= (uint)value;
_uFlags = (_uFlags & ~(uint)ushort.MaxValue) | value;
}
#endif
}
Expand All @@ -221,13 +182,6 @@ internal ushort GenericParameterCount
Debug.Assert(IsGenericTypeDefinition);
return (ushort)_uBaseSize;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
Debug.Assert(IsGenericTypeDefinition);
_uBaseSize = value;
}
#endif
}

internal uint Flags
Expand All @@ -251,14 +205,6 @@ internal ushort ExtendedFlags
{
return HasComponentSize ? (ushort)0 : (ushort)_uFlags;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
Debug.Assert(!HasComponentSize);
Debug.Assert(ExtendedFlags == 0);
_uFlags |= (uint)value;
}
#endif
}

internal uint RawBaseSize
Expand All @@ -282,12 +228,6 @@ internal uint BaseSize
Debug.Assert(IsCanonical || IsArray);
return _uBaseSize;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
_uBaseSize = value;
}
#endif
}

internal ushort NumVtableSlots
Expand Down Expand Up @@ -643,13 +583,6 @@ internal uint NumFunctionPointerParameters
Debug.Assert(IsFunctionPointer);
return _uBaseSize & ~FunctionPointerFlags.FlagsMask;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
Debug.Assert(IsFunctionPointer);
_uBaseSize = value | (_uBaseSize & FunctionPointerFlags.FlagsMask);
}
#endif
}

internal bool IsUnmanagedFunctionPointer
Expand All @@ -659,16 +592,6 @@ internal bool IsUnmanagedFunctionPointer
Debug.Assert(IsFunctionPointer);
return (_uBaseSize & FunctionPointerFlags.IsUnmanaged) != 0;
}
#if TYPE_LOADER_IMPLEMENTATION
set
{
Debug.Assert(IsFunctionPointer);
if (value)
_uBaseSize |= FunctionPointerFlags.IsUnmanaged;
else
_uBaseSize &= ~FunctionPointerFlags.IsUnmanaged;
}
#endif
}

internal MethodTableList FunctionPointerParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,13 @@ private static RuntimeTypeHandle GetRuntimeTypeHandleIfAny(RuntimeTypeInfo eleme
{
Debug.Assert(multiDim || rank == 1);

if (elementType.IsByRef || elementType.IsVoid || elementType.IsByRefLike)
throw new TypeLoadException(SR.Format(SR.ArgumentException_InvalidArrayElementType, elementType));

RuntimeTypeHandle elementTypeHandle = elementType.InternalTypeHandleIfAvailable;
if (elementTypeHandle.IsNull())
return default(RuntimeTypeHandle);

// The check is here on purpose - one of the implementations of IsByRefLike contains a custom attribute
// search and those are very expensive from size on disk footprint perspective. We purposefully
// place this call in a path that won't be part of the executable image unless more advanced reflection services
// are also needed ("pay for play"). We really don't want a typeof() to push the app into requiring the full reflection
// stack to be compiled into the final executable.
if (elementType.IsByRefLike)
throw new TypeLoadException(SR.Format(SR.ArgumentException_InvalidArrayElementType, elementType));

RuntimeTypeHandle typeHandle;
if (!multiDim)
{
Expand All @@ -140,8 +135,6 @@ private sealed class ArrayTypeTable : ConcurrentUnifierWKeyed<UnificationKey, Ru
{
protected sealed override RuntimeArrayTypeInfo Factory(UnificationKey key)
{
ValidateElementType(key.ElementType, multiDim: false, rank: 1);

return new RuntimeArrayTypeInfo(key, multiDim: false, rank: 1);
}

Expand All @@ -157,8 +150,6 @@ public MultiDimArrayTypeTable(int rank)

protected sealed override RuntimeArrayTypeInfo Factory(UnificationKey key)
{
ValidateElementType(key.ElementType, multiDim: true, rank: _rank);

return new RuntimeArrayTypeInfo(key, multiDim: true, rank: _rank);
}

Expand All @@ -178,14 +169,6 @@ protected sealed override MultiDimArrayTypeTable Factory(int rank)

public static readonly TypeTableForMultiDimArrayTypeTables Table = new TypeTableForMultiDimArrayTypeTables();
}

private static void ValidateElementType(RuntimeTypeInfo elementType, bool multiDim, int rank)
{
Debug.Assert(multiDim || rank == 1);

if (elementType.IsByRef || elementType.IsVoid)
throw new TypeLoadException(SR.Format(SR.ArgumentException_InvalidArrayElementType, elementType));
}
}

//-----------------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,6 @@ private static unsafe MethodInvokeInfo TryGetMethodInvokeInfo(
return null;
}

if ((methodInvokeMetadata.InvokeTableFlags & InvokeTableFlags.CallingConventionMask) != 0)
{
// MethodInvokeInfo found, but it references a method with a native calling convention.
return null;
}

IntPtr dynamicInvokeMethod;
Debug.Assert((methodInvokeMetadata.InvokeTableFlags & InvokeTableFlags.NeedsParameterInterpretation) == 0);
dynamicInvokeMethod = GetDynamicMethodInvoke(
Expand Down Expand Up @@ -699,10 +693,8 @@ private static unsafe bool TryGetMethodForOriginalLdFtnResult_GenericMethodWithI
Debug.Assert(!isAsyncVariant, "Async variants should not be visible to reflection");
if (success)
{
if (TypeLoaderEnvironment.Instance.TryGetMetadataForTypeMethodNameAndSignature(declaringTypeHandle, nameAndSig, out methodHandle))
{
return true;
}
methodHandle = new QMethodDefinition(nameAndSig.Reader, nameAndSig.Handle);
return true;
}

methodHandle = default(QMethodDefinition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public int LookupHashCode
return _defType.ConvertToCanonForm(CanonicalFormKind.Specific).GetHashCode();

if (!_genericDefinition.IsNull())
return TypeLoaderEnvironment.Instance.GetCanonicalHashCode(_typeToFind, CanonicalFormKind.Specific);
return TypeLoaderEnvironment.Instance.GetCanonicalHashCode(_typeToFind);
else
return _typeToFind.GetHashCode();
}
Expand All @@ -74,7 +74,7 @@ public bool IsCanonicallyEquivalent(RuntimeTypeHandle other)
RuntimeTypeHandle[] otherGenericArgs;
otherGenericDefinition = RuntimeAugments.GetGenericInstantiation(other, out otherGenericArgs);

return _genericDefinition.Equals(otherGenericDefinition) && TypeLoaderEnvironment.Instance.CanInstantiationsShareCode(_genericArgs, otherGenericArgs, CanonicalFormKind.Specific);
return _genericDefinition.Equals(otherGenericDefinition) && TypeLoaderEnvironment.Instance.CanInstantiationsShareCode(_genericArgs, otherGenericArgs);
}
else
return false;
Expand Down
Loading
Loading