Browse Source

StatementTransform: Run an expensive invariant check slightly less often.

pull/2566/head
Daniel Grunwald 4 years ago
parent
commit
d0012bf7d8
  1. 5
      ICSharpCode.Decompiler/IL/Transforms/StatementTransform.cs

5
ICSharpCode.Decompiler/IL/Transforms/StatementTransform.cs

@ -133,7 +133,6 @@ namespace ICSharpCode.Decompiler.IL.Transforms
} }
foreach (var transform in children) foreach (var transform in children)
{ {
Debug.Assert(block.HasFlag(InstructionFlags.EndPointUnreachable));
transform.Run(block, pos, ctx); transform.Run(block, pos, ctx);
#if DEBUG #if DEBUG
block.Instructions[pos].CheckInvariant(ILPhase.Normal); block.Instructions[pos].CheckInvariant(ILPhase.Normal);
@ -160,6 +159,10 @@ namespace ICSharpCode.Decompiler.IL.Transforms
pos--; pos--;
} }
} }
// This invariant can be surprisingly expensive to check if the block has thousands
// of instructions and is frequently modified by transforms (invalidating the flags each time)
// so we'll check this only once at the end of the block.
Debug.Assert(block.HasFlag(InstructionFlags.EndPointUnreachable));
} }
} }
} }

Loading…
Cancel
Save