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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user