You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
@@ -111,7 +111,7 @@ namespace Mono.Cecil.Rocks {
|
||||
id.Append (((GenericParameter) type).Position);
|
||||
break;
|
||||
case MetadataType.OptionalModifier:
|
||||
WriteModiferTypeSignature ((RequiredModifierType) type, '!');
|
||||
WriteModiferTypeSignature ((OptionalModifierType) type, '!');
|
||||
break;
|
||||
case MetadataType.RequiredModifier:
|
||||
WriteModiferTypeSignature ((RequiredModifierType) type, '|');
|
||||
|
||||
@@ -174,6 +174,29 @@ namespace Mono.Cecil.Rocks {
|
||||
instruction.Operand = null;
|
||||
}
|
||||
|
||||
public static void Optimize (this MethodBody self)
|
||||
{
|
||||
if (self == null)
|
||||
throw new ArgumentNullException ("self");
|
||||
|
||||
OptimizeLongs (self);
|
||||
OptimizeMacros (self);
|
||||
}
|
||||
|
||||
static void OptimizeLongs (this MethodBody self)
|
||||
{
|
||||
for (var i = 0; i < self.Instructions.Count; i++) {
|
||||
var instruction = self.Instructions [i];
|
||||
if (instruction.OpCode.Code != Code.Ldc_I8)
|
||||
continue;
|
||||
var l = (long)instruction.Operand;
|
||||
if (l >= uint.MaxValue)
|
||||
continue;
|
||||
ExpandMacro (instruction, OpCodes.Ldc_I4, (uint)l);
|
||||
self.Instructions.Insert (++i, Instruction.Create (OpCodes.Conv_I8));
|
||||
}
|
||||
}
|
||||
|
||||
public static void OptimizeMacros (this MethodBody self)
|
||||
{
|
||||
if (self == null)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
// Licensed under the MIT/X11 license.
|
||||
//
|
||||
|
||||
#if !NET_CORE
|
||||
|
||||
using System;
|
||||
using System.Security;
|
||||
using SSP = System.Security.Permissions;
|
||||
@@ -150,3 +152,5 @@ namespace Mono.Cecil.Rocks {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user