Browse Source

Remove Block.Phase1Boundary

pull/728/head
Daniel Grunwald 10 years ago
parent
commit
db1185ed3f
  1. 19
      ICSharpCode.Decompiler/IL/Instructions/Block.cs
  2. 2
      ICSharpCode.Decompiler/IL/Instructions/IfInstruction.cs
  3. 2
      ICSharpCode.Decompiler/IL/Instructions/SwitchInstruction.cs
  4. 9
      ICSharpCode.Decompiler/IL/Instructions/TryInstruction.cs

19
ICSharpCode.Decompiler/IL/Instructions/Block.cs

@ -158,29 +158,18 @@ namespace ICSharpCode.Decompiler.IL @@ -158,29 +158,18 @@ namespace ICSharpCode.Decompiler.IL
protected override SlotInfo GetChildSlot(int index)
{
if (index == Instructions.Count)
return InstructionSlot;
else
return FinalInstructionSlot;
else
return InstructionSlot;
}
protected override InstructionFlags ComputeFlags()
{
var flags = InstructionFlags.None;
foreach (var inst in Instructions) {
flags |= Phase1Boundary(inst.Flags);
flags |= inst.Flags;
}
flags |= Phase1Boundary(FinalInstruction.Flags);
return flags;
}
/// <summary>
/// Adjust flags for a phase-1 boundary:
/// The MayPop and MayPeek flags are removed and converted into
/// MayReadEvaluationStack and/or MayWriteEvaluationStack flags.
/// </summary>
[Obsolete("there's no phase-1 evaluation anymore")]
internal static InstructionFlags Phase1Boundary(InstructionFlags flags)
{
flags |= FinalInstruction.Flags;
return flags;
}
}

2
ICSharpCode.Decompiler/IL/Instructions/IfInstruction.cs

@ -54,7 +54,7 @@ namespace ICSharpCode.Decompiler.IL @@ -54,7 +54,7 @@ namespace ICSharpCode.Decompiler.IL
protected override InstructionFlags ComputeFlags()
{
return condition.Flags | Block.Phase1Boundary(CombineFlags(trueInst.Flags, falseInst.Flags));
return condition.Flags | CombineFlags(trueInst.Flags, falseInst.Flags);
}
internal static InstructionFlags CombineFlags(InstructionFlags trueFlags, InstructionFlags falseFlags)

2
ICSharpCode.Decompiler/IL/Instructions/SwitchInstruction.cs

@ -119,7 +119,7 @@ namespace ICSharpCode.Decompiler.IL @@ -119,7 +119,7 @@ namespace ICSharpCode.Decompiler.IL
protected override InstructionFlags ComputeFlags()
{
return Block.Phase1Boundary(body.Flags);
return body.Flags;
}
public override void WriteTo(ITextOutput output)

9
ICSharpCode.Decompiler/IL/Instructions/TryInstruction.cs

@ -84,7 +84,7 @@ namespace ICSharpCode.Decompiler.IL @@ -84,7 +84,7 @@ namespace ICSharpCode.Decompiler.IL
protected override InstructionFlags ComputeFlags()
{
var flags = Block.Phase1Boundary(TryBlock.Flags);
var flags = TryBlock.Flags;
foreach (var handler in Handlers)
flags = IfInstruction.CombineFlags(flags, handler.Flags);
return flags;
@ -147,7 +147,7 @@ namespace ICSharpCode.Decompiler.IL @@ -147,7 +147,7 @@ namespace ICSharpCode.Decompiler.IL
protected override InstructionFlags ComputeFlags()
{
return Block.Phase1Boundary(filter.Flags) | Block.Phase1Boundary(body.Flags);
return filter.Flags | body.Flags;
}
public override void WriteTo(ITextOutput output)
@ -220,7 +220,7 @@ namespace ICSharpCode.Decompiler.IL @@ -220,7 +220,7 @@ namespace ICSharpCode.Decompiler.IL
protected override InstructionFlags ComputeFlags()
{
// if the endpoint of either the try or the finally is unreachable, the endpoint of the try-finally will be unreachable
return Block.Phase1Boundary(TryBlock.Flags) | Block.Phase1Boundary(finallyBlock.Flags);
return TryBlock.Flags | finallyBlock.Flags;
}
protected override int GetChildCount()
@ -307,8 +307,7 @@ namespace ICSharpCode.Decompiler.IL @@ -307,8 +307,7 @@ namespace ICSharpCode.Decompiler.IL
protected override InstructionFlags ComputeFlags()
{
// The endpoint of the try-fault is unreachable iff the try endpoint is unreachable
return Block.Phase1Boundary(TryBlock.Flags)
| Block.Phase1Boundary(faultBlock.Flags & ~InstructionFlags.EndPointUnreachable);
return TryBlock.Flags | (faultBlock.Flags & ~InstructionFlags.EndPointUnreachable);
}
protected override int GetChildCount()

Loading…
Cancel
Save