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 @@ -239,7 +239,6 @@
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\JitHelpers.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeHelpers.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeFeature.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\CriticalHandle.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\GCHandle.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\Marshal.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\MemoryMarshal.Mono.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ private void SetGenericValueImpl<T>(int pos, ref T value)
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void SetValueRelaxedImpl(object? value, int pos);

#pragma warning disable CA1822
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these different? Is it just the volume and number of callers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are accessed as instance calls from JIT

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like InternalArray__ICollection_get_Count, InternalArray__IReadOnlyCollection_get_Count and few others which are accessing class members do not need the suppression.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention is to indicate that none of the methods should be made static even if they could

/*
* These methods are used to implement the implicit generic interfaces
* implemented by arrays in NET 2.0.
Expand Down Expand Up @@ -637,5 +638,6 @@ internal void InternalArray__set_Item<T>(int index, T item)
// Do not change this to call SetGenericValue_icall directly, due to special casing in the runtime.
SetGenericValueImpl(index, ref item);
}
#pragma warning restore CA1822
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private void BuildStackFrame(int skipFrames, bool needFileInfo)
}
}

private bool AppendStackFrameWithoutMethodBase(StringBuilder sb) => false;
private static bool AppendStackFrameWithoutMethodBase(StringBuilder sb) => false;

[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern bool get_frame_info(int skipFrames, bool needFileInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected sealed override Delegate CombineImpl(Delegate? follow)
}

/* Based on the Boyer-Moore string search algorithm */
private int LastIndexOf(Delegate[] haystack, Delegate[] needle)
private static int LastIndexOf(Delegate[] haystack, Delegate[] needle)
{
if (haystack.Length < needle.Length)
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,61 +419,14 @@ public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
}

private Exception not_supported()
private static Exception not_supported()
{
// Strange message but this is what MS.NET prints...
return new NotSupportedException("The invoked member is not supported in a dynamic module.");
}

private string create_assembly_version(string version)
{
string[] parts = version.Split('.');
int[] ver = new int[4] { 0, 0, 0, 0 };

if ((parts.Length < 0) || (parts.Length > 4))
throw new ArgumentException("The version specified '" + version + "' is invalid");

for (int i = 0; i < parts.Length; ++i)
{
if (parts[i] == "*")
{
DateTime now = DateTime.Now;

if (i == 2)
{
ver[2] = (now - new DateTime(2000, 1, 1)).Days;
if (parts.Length == 3)
ver[3] = (now.Second + (now.Minute * 60) + (now.Hour * 3600)) / 2;
}
else
if (i == 3)
ver[3] = (now.Second + (now.Minute * 60) + (now.Hour * 3600)) / 2;
else
throw new ArgumentException("The version specified '" + version + "' is invalid");
}
else
{
try
{
ver[i] = int.Parse(parts[i]);
}
catch (FormatException)
{
throw new ArgumentException("The version specified '" + version + "' is invalid");
}
}
}

return ver[0] + "." + ver[1] + "." + ver[2] + "." + ver[3];
}

private string GetCultureString(string str)
{
return (str == "neutral" ? string.Empty : str);
}

/*Warning, @typeArguments must be a mscorlib internal array. So make a copy before passing it in*/
internal Type MakeGenericType(Type gtd, Type[] typeArguments)
internal static Type MakeGenericType(Type gtd, Type[] typeArguments)
{
return new TypeBuilderInstantiation(gtd, typeArguments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,17 @@ private void RejectIfCreated()
throw new InvalidOperationException("Type definition of the method is complete.");
}

private Exception not_supported()
private static Exception not_supported()
{
return new NotSupportedException("The invoked member is not supported in a dynamic module.");
}

private Exception not_after_created()
private static Exception not_after_created()
{
return new InvalidOperationException("Unable to change after type has been created.");
}

private Exception not_created()
private static Exception not_created()
{
return new NotSupportedException("The type is not yet created.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public CustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs,
Initialize(con, constructorArgs, namedProperties, propertyValues, namedFields, fieldValues);
}

private bool IsValidType(Type t)
private static bool IsValidType(Type t)
{
/* FIXME: Add more checks */
if (t.IsArray && t.GetArrayRank() > 1)
Expand All @@ -130,7 +130,7 @@ private bool IsValidType(Type t)
return true;
}

private bool IsValidParam(object o, Type paramType)
private static bool IsValidParam(object o, Type paramType)
{
Type t = o.GetType();
if (!IsValidType(t))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public override void SetValue(object? obj, object? val, BindingFlags invokeAttr,
throw CreateNotSupportedException();
}

private Exception CreateNotSupportedException()
private static Exception CreateNotSupportedException()
{
return new NotSupportedException("The invoked member is not supported in a dynamic module.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
}

private Exception not_supported()
private static Exception not_supported()
{
return new NotSupportedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,8 @@ internal struct ILExceptionBlock
internal int len;
internal int filter_offset;
#endregion

internal void Debug()
{
#if FALSE
System.Console.Write ("\ttype="+type.ToString()+" start="+start.ToString()+" len="+len.ToString());
if (extype != null)
System.Console.WriteLine (" extype="+extype.ToString());
else
System.Console.WriteLine (String.Empty);
#endif
}
}

internal struct ILExceptionInfo
{
#region Sync with MonoILExceptionInfo in object-internals.h
Expand Down Expand Up @@ -153,15 +143,6 @@ internal void PatchFilterClause(int start)
}
}

internal void Debug(int b)
{
#if FALSE
System.Console.WriteLine ("Handler {0} at {1}, len: {2}", b, start, len);
for (int i = 0; i < handlers.Length; ++i)
handlers [i].Debug ();
#endif
}

private void add_block(int offset)
{
if (handlers != null)
Expand Down Expand Up @@ -947,13 +928,9 @@ public virtual void EndExceptionBlock()
InternalEndClause();
MarkLabel(ex_handlers[cur_block].end);
ex_handlers[cur_block].End(code_len);
ex_handlers[cur_block].Debug(cur_block);
//System.Console.WriteLine ("End Block {0} (handlers: {1})", cur_block, ex_handlers [cur_block].NumHandlers ());
open_blocks.Pop();
if (open_blocks.Count > 0)
cur_block = (int)open_blocks.Peek()!;
//Console.WriteLine ("curblock restored to {0}", cur_block);
//throw new NotImplementedException ();
}

public virtual void EndScope()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ internal override int get_next_table_index(object obj, int table, int count)
return type.get_next_table_index(obj, table, count);
}

private void ExtendArray<T>([NotNull] ref T[]? array, T elem)
private static void ExtendArray<T>([NotNull] ref T[]? array, T elem)
{
if (array == null)
{
Expand All @@ -560,7 +560,7 @@ private void RejectIfCreated()
throw new InvalidOperationException("Type definition of the method is complete.");
}

private Exception NotSupported()
private static Exception NotSupported()
{
return new NotSupportedException("The invoked member is not supported in a dynamic module.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type under
return GetType(className, false, ignoreCase);
}

private TypeBuilder? search_in_array(TypeBuilder[] arr, int validElementsInArray, ITypeName className)
private static TypeBuilder? search_in_array(TypeBuilder[] arr, int validElementsInArray, ITypeName className)
{
int i;
for (i = 0; i < validElementsInArray; ++i)
Expand All @@ -385,7 +385,7 @@ public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type under
return null;
}

private TypeBuilder? search_nested_in_array(TypeBuilder[] arr, int validElementsInArray, ITypeName className)
private static TypeBuilder? search_nested_in_array(TypeBuilder[] arr, int validElementsInArray, ITypeName className)
{
int i;
for (i = 0; i < validElementsInArray; ++i)
Expand All @@ -396,7 +396,7 @@ public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type under
return null;
}

private TypeBuilder? GetMaybeNested(TypeBuilder t, IEnumerable<ITypeName> nested)
private static TypeBuilder? GetMaybeNested(TypeBuilder t, IEnumerable<ITypeName> nested)
{
TypeBuilder? result = t;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public override Module Module
}
}

private Exception not_supported()
private static Exception not_supported()
{
return new NotSupportedException("The invoked member is not supported in a dynamic module.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
return created!.GetMembers(bindingAttr);
}

private MethodInfo[] GetMethodsByName(string? name, BindingFlags bindingAttr, bool ignoreCase, Type reflected_type)
private MethodInfo[] GetMethodsByName(string? name, BindingFlags bindingAttr, bool ignoreCase)
{
MethodInfo[]? candidates;
bool match;
Expand Down Expand Up @@ -1221,7 +1221,7 @@ public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
{
check_created();

return GetMethodsByName(null, bindingAttr, false, this);
return GetMethodsByName(null, bindingAttr, false);
}

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
Expand Down Expand Up @@ -1411,7 +1411,7 @@ public override Type MakeGenericType(params Type[] typeArguments)

Type[] copy = new Type[typeArguments.Length];
typeArguments.CopyTo(copy, 0);
return pmodule.assemblyb.MakeGenericType(this, copy);
return AssemblyBuilder.MakeGenericType(this, copy);
}

public override Type MakePointerType()
Expand Down Expand Up @@ -1682,7 +1682,7 @@ internal bool is_created
}
}

private Exception not_supported()
private static Exception not_supported()
{
return new NotSupportedException("The invoked member is not supported in a dynamic module.");
}
Expand All @@ -1699,7 +1699,7 @@ private void check_created()
throw not_supported();
}

private void check_name(string argName, string name)
private static void check_name(string argName, string name)
{
if (name == null)
throw new ArgumentNullException(argName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ internal class RuntimeFieldInfo : RtFieldInfo
private FieldAttributes attrs;
#pragma warning restore 649

internal BindingFlags BindingFlags
{
get
{
return 0;
}
}

public override Module Module
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,6 @@ internal class RuntimeMethodInfo : MethodInfo
#endregion
private string? toString;

internal BindingFlags BindingFlags
{
get
{
return 0;
}
}

public override Module Module
{
get
Expand Down Expand Up @@ -794,14 +786,6 @@ internal RuntimeModule GetRuntimeModule()
return RuntimeTypeHandle.GetModule((RuntimeType)DeclaringType);
}

internal BindingFlags BindingFlags
{
get
{
return 0;
}
}

private RuntimeType? ReflectedTypeInternal
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ object[] GetCustomAttributes(Type attributeType, bool inherit)
return CustomAttribute.GetCustomAttributes(this, attributeType, inherit);
}

internal object? GetDefaultValueImpl(ParameterInfo pinfo)
internal static object? GetDefaultValueImpl(ParameterInfo pinfo)
{
FieldInfo field = typeof(ParameterInfo).GetField("DefaultValueImpl", BindingFlags.Instance | BindingFlags.NonPublic)!;
return field.GetValue(pinfo);
Expand Down

This file was deleted.

Loading