diff options
author | Michal Strehovsky <michals@microsoft.com> | 2017-07-15 00:17:43 +0300 |
---|---|---|
committer | Michal Strehovsky <michals@microsoft.com> | 2017-07-15 00:17:43 +0300 |
commit | 3e6dc26c626ed2c1234d5a72435f931513ba2360 (patch) | |
tree | 6460b7eafbf3304d162807a6be603890ac690783 /src/System.Private.Reflection.Execution | |
parent | aad567bc7b3965f4d10e7d5129fce833e5461c24 (diff) |
Make metadata collections no longer implement generic IReadOnlyCollection
This has a positive size on disk impact since generic IEnumerable and IEnumerator interfaces come with a bunch of costs. Low level metadata APIs don't have to be fancy. This also removes a bunch of boxing as an added bonus.
[tfs-changeset: 1666112]
Diffstat (limited to 'src/System.Private.Reflection.Execution')
2 files changed, 6 insertions, 5 deletions
diff --git a/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/MethodInvokers/IntPtrConstructorMethodInvoker.cs b/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/MethodInvokers/IntPtrConstructorMethodInvoker.cs index 51e101e42..1cbe6ed6c 100644 --- a/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/MethodInvokers/IntPtrConstructorMethodInvoker.cs +++ b/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/MethodInvokers/IntPtrConstructorMethodInvoker.cs @@ -27,10 +27,12 @@ namespace Internal.Reflection.Execution.MethodInvokers // Since we control the definition of System.IntPtr, we only do enough analysis of the signature to disambiguate the constructors we support. _id = IntPtrConstructorId.None; Method method = methodHandle.GetMethod(reader); - Handle[] parameterTypeSignatureHandles = method.Signature.GetMethodSignature(reader).Parameters.ToArray(); - if (parameterTypeSignatureHandles.Length == 1) + HandleCollection parameterTypeSignatureHandles = method.Signature.GetMethodSignature(reader).Parameters; + if (parameterTypeSignatureHandles.Count == 1) { - Handle parameterTypeHandle = parameterTypeSignatureHandles[0]; + HandleCollection.Enumerator enumerator = parameterTypeSignatureHandles.GetEnumerator(); + enumerator.MoveNext(); + Handle parameterTypeHandle = enumerator.Current; // If any parameter is a pointer type, bail as we don't support Invokes on pointers. if (parameterTypeHandle.HandleType != HandleType.TypeDefinition) diff --git a/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/MethodInvokers/NullableInstanceMethodInvoker.cs b/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/MethodInvokers/NullableInstanceMethodInvoker.cs index be7f54a35..31d817f73 100644 --- a/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/MethodInvokers/NullableInstanceMethodInvoker.cs +++ b/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/MethodInvokers/NullableInstanceMethodInvoker.cs @@ -71,8 +71,7 @@ namespace Internal.Reflection.Execution.MethodInvokers break; case "GetValueOrDefault": - IEnumerator<Handle> parameters = method.Signature.GetMethodSignature(reader).Parameters.GetEnumerator(); - if (parameters.MoveNext()) + if (method.Signature.GetMethodSignature(reader).Parameters.Count == 1) _id = NullableMethodId.GetValueOrDefault_1; else _id = NullableMethodId.GetValueOrDefault_0; |