|
|
@ -32,6 +32,7 @@ namespace Decompiler |
|
|
|
{ |
|
|
|
{ |
|
|
|
public ILLabel Label; // Non-null only if needed
|
|
|
|
public ILLabel Label; // Non-null only if needed
|
|
|
|
public int Offset; |
|
|
|
public int Offset; |
|
|
|
|
|
|
|
public int EndOffset; |
|
|
|
public OpCode OpCode; |
|
|
|
public OpCode OpCode; |
|
|
|
public object Operand; |
|
|
|
public object Operand; |
|
|
|
public int? PopCount; // Null means pop all
|
|
|
|
public int? PopCount; // Null means pop all
|
|
|
@ -118,6 +119,7 @@ namespace Decompiler |
|
|
|
MethodBodyRocks.ExpandMacro(ref opCode, ref operand, methodDef.Body); |
|
|
|
MethodBodyRocks.ExpandMacro(ref opCode, ref operand, methodDef.Body); |
|
|
|
ByteCode byteCode = new ByteCode() { |
|
|
|
ByteCode byteCode = new ByteCode() { |
|
|
|
Offset = inst.Offset, |
|
|
|
Offset = inst.Offset, |
|
|
|
|
|
|
|
EndOffset = inst.Next != null ? inst.Next.Offset : methodDef.Body.CodeSize, |
|
|
|
OpCode = opCode, |
|
|
|
OpCode = opCode, |
|
|
|
Operand = operand, |
|
|
|
Operand = operand, |
|
|
|
PopCount = inst.GetPopCount(), |
|
|
|
PopCount = inst.GetPopCount(), |
|
|
@ -360,6 +362,7 @@ namespace Decompiler |
|
|
|
MethodBodyRocks.ExpandMacro(ref opCode, ref operand, methodDef.Body); |
|
|
|
MethodBodyRocks.ExpandMacro(ref opCode, ref operand, methodDef.Body); |
|
|
|
|
|
|
|
|
|
|
|
ILExpression expr = new ILExpression(opCode, operand); |
|
|
|
ILExpression expr = new ILExpression(opCode, operand); |
|
|
|
|
|
|
|
expr.ILRanges.Add(new ILRange() { From = byteCode.Offset, To = byteCode.EndOffset }); |
|
|
|
|
|
|
|
|
|
|
|
// Label for this instruction
|
|
|
|
// Label for this instruction
|
|
|
|
if (byteCode.Label != null) { |
|
|
|
if (byteCode.Label != null) { |
|
|
@ -417,6 +420,9 @@ namespace Decompiler |
|
|
|
bool canInline; |
|
|
|
bool canInline; |
|
|
|
allowInline.TryGetValue((ILVariable)arg.Operand, out canInline); |
|
|
|
allowInline.TryGetValue((ILVariable)arg.Operand, out canInline); |
|
|
|
if (arg.Operand == currExpr.Operand && canInline) { |
|
|
|
if (arg.Operand == currExpr.Operand && canInline) { |
|
|
|
|
|
|
|
// Assigne the ranges for optimized away instrustions somewhere
|
|
|
|
|
|
|
|
currExpr.Arguments[0].ILRanges.AddRange(currExpr.ILRanges); |
|
|
|
|
|
|
|
currExpr.Arguments[0].ILRanges.AddRange(nextExpr.Arguments[j].ILRanges); |
|
|
|
ast.RemoveAt(i); |
|
|
|
ast.RemoveAt(i); |
|
|
|
nextExpr.Arguments[j] = currExpr.Arguments[0]; // Inline the stloc body
|
|
|
|
nextExpr.Arguments[j] = currExpr.Arguments[0]; // Inline the stloc body
|
|
|
|
i -= 2; // Try the same index again
|
|
|
|
i -= 2; // Try the same index again
|
|
|
|