diff options
author | Marek Safar <marek.safar@gmail.com> | 2022-10-06 12:15:52 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2022-10-06 12:15:52 +0300 |
commit | 186a05b95879dd6f546bf2e21aaa54680d3d4711 (patch) | |
tree | cda666d27eb727e45cfbff127e2b06d9156050ca /Mono.Cecil | |
parent | 1840b7410d37a613e684b6f9650e39e2d4950bbb (diff) | |
parent | e052ab52e44fd2a6564964e47e79929068731916 (diff) |
Merge remote-tracking branch 'upstream/master' into sync
Diffstat (limited to 'Mono.Cecil')
-rw-r--r-- | Mono.Cecil/AssemblyReader.cs | 19 | ||||
-rw-r--r-- | Mono.Cecil/AssemblyWriter.cs | 1 | ||||
-rw-r--r-- | Mono.Cecil/MetadataSystem.cs | 50 | ||||
-rw-r--r-- | Mono.Cecil/MethodCallingConvention.cs | 1 | ||||
-rw-r--r-- | Mono.Cecil/MethodDefinition.cs | 5 | ||||
-rw-r--r-- | Mono.Cecil/MethodImplAttributes.cs | 33 |
6 files changed, 24 insertions, 85 deletions
diff --git a/Mono.Cecil/AssemblyReader.cs b/Mono.Cecil/AssemblyReader.cs index 4180d78..0756fa8 100644 --- a/Mono.Cecil/AssemblyReader.cs +++ b/Mono.Cecil/AssemblyReader.cs @@ -899,8 +899,6 @@ namespace Mono.Cecil { nested_types.Add (nested_type); } - metadata.RemoveNestedTypeMapping (type); - return nested_types; } @@ -975,7 +973,6 @@ namespace Mono.Cecil { if (!metadata.TryGetReverseNestedTypeMapping (type, out declaring_rid)) return null; - metadata.RemoveReverseNestedTypeMapping (type); return GetTypeDefinition (declaring_rid); } @@ -1242,8 +1239,6 @@ namespace Mono.Cecil { new MetadataToken(TokenType.InterfaceImpl, mapping [i].Col1))); } - metadata.RemoveInterfaceMapping (type); - return interfaces; } @@ -1466,8 +1461,6 @@ namespace Mono.Cecil { var events = new MemberDefinitionCollection<EventDefinition> (type, (int) range.Length); - metadata.RemoveEventsRange (type); - if (range.Length == 0) return events; @@ -1536,8 +1529,6 @@ namespace Mono.Cecil { if (!metadata.TryGetPropertiesRange (type, out range)) return new MemberDefinitionCollection<PropertyDefinition> (type); - metadata.RemovePropertiesRange (type); - var properties = new MemberDefinitionCollection<PropertyDefinition> (type, (int) range.Length); if (range.Length == 0) @@ -1912,8 +1903,6 @@ namespace Mono.Cecil { if (!metadata.TryGetGenericParameterRanges (provider, out ranges)) return new GenericParameterCollection (provider); - metadata.RemoveGenericParameterRange (provider); - var generic_parameters = new GenericParameterCollection (provider, RangesSize (ranges)); for (int i = 0; i < ranges.Length; i++) @@ -2029,8 +2018,6 @@ namespace Mono.Cecil { new MetadataToken (TokenType.GenericParamConstraint, mapping [i].Col1))); } - metadata.RemoveGenericConstraintMapping (generic_parameter); - return constraints; } @@ -2083,8 +2070,6 @@ namespace Mono.Cecil { for (int i = 0; i < mapping.Count; i++) overrides.Add ((MethodReference) LookupToken (mapping [i])); - metadata.RemoveOverrideMapping (method); - return overrides; } @@ -2521,8 +2506,6 @@ namespace Mono.Cecil { for (int i = 0; i < ranges.Length; i++) ReadCustomAttributeRange (ranges [i], custom_attributes); - metadata.RemoveCustomAttributeRange (owner); - if (module.IsWindowsMetadata ()) foreach (var custom_attribute in custom_attributes) WindowsRuntimeProjections.Project (owner, custom_attribute); @@ -2676,8 +2659,6 @@ namespace Mono.Cecil { for (int i = 0; i < ranges.Length; i++) ReadSecurityDeclarationRange (ranges [i], security_declarations); - metadata.RemoveSecurityDeclarationRange (owner); - return security_declarations; } diff --git a/Mono.Cecil/AssemblyWriter.cs b/Mono.Cecil/AssemblyWriter.cs index b8b2b14..91edba0 100644 --- a/Mono.Cecil/AssemblyWriter.cs +++ b/Mono.Cecil/AssemblyWriter.cs @@ -2198,6 +2198,7 @@ namespace Mono.Cecil { case ElementType.None: case ElementType.Var: case ElementType.MVar: + case ElementType.GenericInst: signature.WriteInt32 (0); break; case ElementType.String: diff --git a/Mono.Cecil/MetadataSystem.cs b/Mono.Cecil/MetadataSystem.cs index 749a39c..a877771 100644 --- a/Mono.Cecil/MetadataSystem.cs +++ b/Mono.Cecil/MetadataSystem.cs @@ -243,11 +243,6 @@ namespace Mono.Cecil { NestedTypes [type_rid] = mapping; } - public void RemoveNestedTypeMapping (TypeDefinition type) - { - NestedTypes.Remove (type.token.RID); - } - public bool TryGetReverseNestedTypeMapping (TypeDefinition type, out uint declaring) { return ReverseNestedTypes.TryGetValue (type.token.RID, out declaring); @@ -258,11 +253,6 @@ namespace Mono.Cecil { ReverseNestedTypes [nested] = declaring; } - public void RemoveReverseNestedTypeMapping (TypeDefinition type) - { - ReverseNestedTypes.Remove (type.token.RID); - } - public bool TryGetInterfaceMapping (TypeDefinition type, out Collection<Row<uint, MetadataToken>> mapping) { return Interfaces.TryGetValue (type.token.RID, out mapping); @@ -273,11 +263,6 @@ namespace Mono.Cecil { Interfaces [type_rid] = mapping; } - public void RemoveInterfaceMapping (TypeDefinition type) - { - Interfaces.Remove (type.token.RID); - } - public void AddPropertiesRange (uint type_rid, Range range) { Properties.Add (type_rid, range); @@ -288,11 +273,6 @@ namespace Mono.Cecil { return Properties.TryGetValue (type.token.RID, out range); } - public void RemovePropertiesRange (TypeDefinition type) - { - Properties.Remove (type.token.RID); - } - public void AddEventsRange (uint type_rid, Range range) { Events.Add (type_rid, range); @@ -303,41 +283,21 @@ namespace Mono.Cecil { return Events.TryGetValue (type.token.RID, out range); } - public void RemoveEventsRange (TypeDefinition type) - { - Events.Remove (type.token.RID); - } - public bool TryGetGenericParameterRanges (IGenericParameterProvider owner, out Range [] ranges) { return GenericParameters.TryGetValue (owner.MetadataToken, out ranges); } - public void RemoveGenericParameterRange (IGenericParameterProvider owner) - { - GenericParameters.Remove (owner.MetadataToken); - } - public bool TryGetCustomAttributeRanges (ICustomAttributeProvider owner, out Range [] ranges) { return CustomAttributes.TryGetValue (owner.MetadataToken, out ranges); } - public void RemoveCustomAttributeRange (ICustomAttributeProvider owner) - { - CustomAttributes.Remove (owner.MetadataToken); - } - public bool TryGetSecurityDeclarationRanges (ISecurityDeclarationProvider owner, out Range [] ranges) { return SecurityDeclarations.TryGetValue (owner.MetadataToken, out ranges); } - public void RemoveSecurityDeclarationRange (ISecurityDeclarationProvider owner) - { - SecurityDeclarations.Remove (owner.MetadataToken); - } - public bool TryGetGenericConstraintMapping (GenericParameter generic_parameter, out Collection<Row<uint, MetadataToken>> mapping) { return GenericConstraints.TryGetValue (generic_parameter.token.RID, out mapping); @@ -348,11 +308,6 @@ namespace Mono.Cecil { GenericConstraints [gp_rid] = mapping; } - public void RemoveGenericConstraintMapping (GenericParameter generic_parameter) - { - GenericConstraints.Remove (generic_parameter.token.RID); - } - public bool TryGetOverrideMapping (MethodDefinition method, out Collection<MetadataToken> mapping) { return Overrides.TryGetValue (method.token.RID, out mapping); @@ -363,11 +318,6 @@ namespace Mono.Cecil { Overrides [rid] = mapping; } - public void RemoveOverrideMapping (MethodDefinition method) - { - Overrides.Remove (method.token.RID); - } - public Document GetDocument (uint rid) { if (rid < 1 || rid > Documents.Length) diff --git a/Mono.Cecil/MethodCallingConvention.cs b/Mono.Cecil/MethodCallingConvention.cs index f9c0e0c..80f3e97 100644 --- a/Mono.Cecil/MethodCallingConvention.cs +++ b/Mono.Cecil/MethodCallingConvention.cs @@ -17,6 +17,7 @@ namespace Mono.Cecil { ThisCall = 0x3, FastCall = 0x4, VarArg = 0x5, + Unmanaged = 0x9, Generic = 0x10, } } diff --git a/Mono.Cecil/MethodDefinition.cs b/Mono.Cecil/MethodDefinition.cs index b4b88d9..b4e4376 100644 --- a/Mono.Cecil/MethodDefinition.cs +++ b/Mono.Cecil/MethodDefinition.cs @@ -440,6 +440,11 @@ namespace Mono.Cecil { set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.AggressiveInlining, value); } } + public bool AggressiveOptimization { + get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.AggressiveOptimization); } + set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.AggressiveOptimization, value); } + } + #endregion #region MethodSemanticsAttributes diff --git a/Mono.Cecil/MethodImplAttributes.cs b/Mono.Cecil/MethodImplAttributes.cs index 2f1f018..23e857b 100644 --- a/Mono.Cecil/MethodImplAttributes.cs +++ b/Mono.Cecil/MethodImplAttributes.cs @@ -14,23 +14,24 @@ namespace Mono.Cecil { [Flags] public enum MethodImplAttributes : ushort { - CodeTypeMask = 0x0003, - IL = 0x0000, // Method impl is CIL - Native = 0x0001, // Method impl is native - OPTIL = 0x0002, // Reserved: shall be zero in conforming implementations - Runtime = 0x0003, // Method impl is provided by the runtime + CodeTypeMask = 0x0003, + IL = 0x0000, // Method impl is CIL + Native = 0x0001, // Method impl is native + OPTIL = 0x0002, // Reserved: shall be zero in conforming implementations + Runtime = 0x0003, // Method impl is provided by the runtime - ManagedMask = 0x0004, // Flags specifying whether the code is managed or unmanaged - Unmanaged = 0x0004, // Method impl is unmanaged, otherwise managed - Managed = 0x0000, // Method impl is managed + ManagedMask = 0x0004, // Flags specifying whether the code is managed or unmanaged + Unmanaged = 0x0004, // Method impl is unmanaged, otherwise managed + Managed = 0x0000, // Method impl is managed - // Implementation info and interop - ForwardRef = 0x0010, // Indicates method is defined; used primarily in merge scenarios - PreserveSig = 0x0080, // Reserved: conforming implementations may ignore - InternalCall = 0x1000, // Reserved: shall be zero in conforming implementations - Synchronized = 0x0020, // Method is single threaded through the body - NoOptimization = 0x0040, // Method is not optimized by the JIT. - NoInlining = 0x0008, // Method may not be inlined - AggressiveInlining = 0x0100, // Method should be inlined, if possible. + ForwardRef = 0x0010, // The method is declared, but its implementation is provided elsewhere. + PreserveSig = 0x0080, // The method signature is exported exactly as declared. + InternalCall = 0x1000, // The call is internal, that is, it calls a method that's implemented within the CLR. + Synchronized = 0x0020, // The method can be executed by only one thread at a time. + // Static methods lock on the type, whereas instance methods lock on the instance. + NoOptimization = 0x0040, // The method is not optimized by the just-in-time (JIT) compiler or by native codegen. + NoInlining = 0x0008, // The method cannot be inlined. + AggressiveInlining = 0x0100, // The method should be inlined if possible. + AggressiveOptimization = 0x0200, // The method contains code that should always be optimized by the JIT compiler. } } |