diff --git a/src/AsmResolver.DotNet/MethodDefinition.cs b/src/AsmResolver.DotNet/MethodDefinition.cs index 4742b1ef8..76e6c517b 100644 --- a/src/AsmResolver.DotNet/MethodDefinition.cs +++ b/src/AsmResolver.DotNet/MethodDefinition.cs @@ -472,7 +472,44 @@ public bool NoInlining { get => (ImplAttributes & MethodImplAttributes.NoInlining) != 0; set => ImplAttributes = (ImplAttributes & ~MethodImplAttributes.NoInlining) - | (value ? MethodImplAttributes.NoInlining : 0); + | (value ? MethodImplAttributes.NoInlining : 0); + } + + /// + /// Gets or sets a value indicating whether the method should be inlined if possible. + /// + public bool IsAggressiveInlining + { + get => (ImplAttributes & MethodImplAttributes.AggressiveInlining) != 0; + set => ImplAttributes = (ImplAttributes & ~MethodImplAttributes.AggressiveInlining) + | (value ? MethodImplAttributes.AggressiveInlining : 0); + } + + /// + /// Gets or sets a value indicating whether the method contains hot code and should be aggressively optimized. + /// + public bool IsAggressiveOptimization + { + get => (ImplAttributes & MethodImplAttributes.AggressiveOptimization) != 0; + set => ImplAttributes = (ImplAttributes & ~MethodImplAttributes.AggressiveOptimization) + | (value ? MethodImplAttributes.AggressiveOptimization : 0); + } + + /// + /// Gets or sets a value indicating that the JIT compiler should look for security mitigation attributes, + /// such as the user-defined System.Runtime.CompilerServices.SecurityMitigationsAttribute. If found, + /// the JIT compiler applies any related security mitigations. Available starting with .NET Framework 4.8. + /// + /// + /// This is an undocumented flag and is currently not used: + /// Original addition: https://github.com/dotnet/dotnet-api-docs/pull/2253 + /// Documentation removal: https://github.com/dotnet/dotnet-api-docs/pull/4652 + /// + public bool HasSecurityMitigations + { + get => (ImplAttributes & MethodImplAttributes.SecurityMitigations) != 0; + set => ImplAttributes = (ImplAttributes & ~MethodImplAttributes.SecurityMitigations) + | (value ? MethodImplAttributes.SecurityMitigations : 0); } /// diff --git a/src/AsmResolver.PE/DotNet/Metadata/Tables/MethodImplAttributes.cs b/src/AsmResolver.PE/DotNet/Metadata/Tables/MethodImplAttributes.cs index 4a46b1572..3e75ee5ec 100644 --- a/src/AsmResolver.PE/DotNet/Metadata/Tables/MethodImplAttributes.cs +++ b/src/AsmResolver.PE/DotNet/Metadata/Tables/MethodImplAttributes.cs @@ -77,5 +77,27 @@ public enum MethodImplAttributes : ushort /// Method may not be inlined. /// NoInlining = 0x0008, + + /// + /// Method should be inlined if possible. + /// + AggressiveInlining = 0x0100, + + /// + /// Method may contain hot code and should be aggressively optimized. + /// + AggressiveOptimization = 0x0200, + + /// + /// Specifies that the JIT compiler should look for security mitigation attributes, such as the user-defined + /// System.Runtime.CompilerServices.SecurityMitigationsAttribute. If found, the JIT compiler applies + /// any related security mitigations. Available starting with .NET Framework 4.8. + /// + /// + /// This is an undocumented flag and is currently not used: + /// Original addition: https://github.com/dotnet/dotnet-api-docs/pull/2253 + /// Documentation removal: https://github.com/dotnet/dotnet-api-docs/pull/4652 + /// + SecurityMitigations, } }