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

Add MethodImplAttributes.AggressiveOptimization #855

Merged
merged 1 commit into from
Sep 29, 2022
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
5 changes: 5 additions & 0 deletions Mono.Cecil/MethodDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,11 @@ public bool AggressiveInlining {
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
Expand Down
33 changes: 17 additions & 16 deletions Mono.Cecil/MethodImplAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}