Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify type instantiations in reflection emit #81518

Merged
merged 14 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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 @@ -163,7 +163,6 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\DynamicMethod.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\ILGenerator.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\LocalBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\MethodBuilderInstantiation.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\ParameterBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeAssemblyBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeConstructorBuilder.cs" />
Expand All @@ -177,9 +176,6 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeTypeBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\SignatureHelper.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\SymbolMethod.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\SymbolType.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\TypeBuilderInstantiation.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\XXXOnTypeBuilderInstantiation.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\FieldInfo.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\LoaderAllocator.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdConstant.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,11 @@ private static MethodBase GetGenericMethodBaseDefinition(MethodBase methodBase)

if (methodBase is MethodOnTypeBuilderInstantiation motbi)
{
methDef = motbi.m_method;
methDef = motbi._method;
}
else if (methodBase is ConstructorOnTypeBuilderInstantiation cotbi)
{
methDef = cotbi.m_ctor;
methDef = cotbi._ctor;
}
else if (methodBase is MethodBuilder || methodBase is ConstructorBuilder)
{
Expand Down Expand Up @@ -445,15 +445,15 @@ internal SignatureHelper GetMemberRefSignature(MethodBase? method, int cGenericP
return methodBuilder.GetMethodSignature();
case RuntimeConstructorBuilder constructorBuilder:
return constructorBuilder.GetMethodSignature();
case MethodOnTypeBuilderInstantiation motbi when motbi.m_method is RuntimeMethodBuilder methodBuilder:
case MethodOnTypeBuilderInstantiation motbi when motbi._method is RuntimeMethodBuilder methodBuilder:
return methodBuilder.GetMethodSignature();
case MethodOnTypeBuilderInstantiation motbi:
method = motbi.m_method;
method = motbi._method;
break;
case ConstructorOnTypeBuilderInstantiation cotbi when cotbi.m_ctor is RuntimeConstructorBuilder constructorBuilder:
case ConstructorOnTypeBuilderInstantiation cotbi when cotbi._ctor is RuntimeConstructorBuilder constructorBuilder:
return constructorBuilder.GetMethodSignature();
case ConstructorOnTypeBuilderInstantiation cotbi:
method = cotbi.m_ctor;
method = cotbi._ctor;
break;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,5 @@ public abstract partial class MethodBase : MemberInfo

internal virtual ParameterInfo[] GetParametersNoCopy() { return GetParameters(); }
#endregion

#region Internal Methods
// helper method to construct the string representation of the parameter list

internal virtual Type[] GetParameterTypes()
{
ParameterInfo[] paramInfo = GetParametersNoCopy();
if (paramInfo.Length == 0)
{
return Type.EmptyTypes;
}

Type[] parameterTypes = new Type[paramInfo.Length];
for (int i = 0; i < paramInfo.Length; i++)
parameterTypes[i] = paramInfo[i].ParameterType;

return parameterTypes;
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -638,15 +638,19 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\AssemblyBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\AssemblyBuilderAccess.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\ConstructorBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\ConstructorOnTypeBuilderInstantiation.cs" Condition="'$(FeatureNativeAot)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\DynamicMethod.cs" Condition="'$(FeatureNativeAot)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\EmptyCAHolder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\EnumBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\EventBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\FieldBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\FieldOnTypeBuilderInstantiation.cs" Condition="'$(FeatureNativeAot)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\FlowControl.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\GenericTypeParameterBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\Label.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\MethodBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\MethodBuilderInstantiation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\MethodOnTypeBuilderInstantiation.cs" Condition="'$(FeatureNativeAot)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\ModuleBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\Opcode.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\OpCodes.cs" />
Expand All @@ -656,7 +660,9 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\PEFileKinds.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\PropertyBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\StackBehaviour.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\SymbolType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\TypeBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\TypeBuilderInstantiation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\TypeNameBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\EventAttributes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\EventInfo.cs" />
Expand Down
Loading