Browse Source

Ensure all pinned regions variables are converted to VariableKind.PinnedRegionLocal

pull/2113/head
Daniel Grunwald 5 years ago
parent
commit
bd4e565b93
  1. 4
      ICSharpCode.Decompiler/IL/ControlFlow/DetectPinnedRegions.cs
  2. 1
      ICSharpCode.Decompiler/IL/Instructions.cs
  3. 3
      ICSharpCode.Decompiler/IL/Instructions.tt

4
ICSharpCode.Decompiler/IL/ControlFlow/DetectPinnedRegions.cs

@ -592,6 +592,10 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow @@ -592,6 +592,10 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
DetectPinnedRegion(block);
body.Blocks.RemoveAll(b => b.Instructions.Count == 0); // remove dummy blocks
body.SetILRange(body.EntryPoint);
if (pinnedRegion.Variable.Kind != VariableKind.PinnedRegionLocal) {
Debug.Assert(pinnedRegion.Variable.Kind == VariableKind.PinnedLocal);
pinnedRegion.Variable.Kind = VariableKind.PinnedRegionLocal;
}
}
private void MoveArrayToPointerToPinnedRegionInit(PinnedRegion pinnedRegion)

1
ICSharpCode.Decompiler/IL/Instructions.cs

@ -1013,6 +1013,7 @@ namespace ICSharpCode.Decompiler.IL @@ -1013,6 +1013,7 @@ namespace ICSharpCode.Decompiler.IL
base.CheckInvariant(phase);
Debug.Assert(phase <= ILPhase.InILReader || this.IsDescendantOf(variable.Function));
Debug.Assert(phase <= ILPhase.InILReader || variable.Function.Variables[variable.IndexInFunction] == variable);
Debug.Assert(Variable.Kind == VariableKind.PinnedRegionLocal);
}
}
}

3
ICSharpCode.Decompiler/IL/Instructions.tt

@ -67,7 +67,8 @@ @@ -67,7 +67,8 @@
CustomChildren(new []{
new ChildInfo("init") { CanInlineInto = true },
new ChildInfo("body")
})),
}),
CustomInvariant("Debug.Assert(Variable.Kind == VariableKind.PinnedRegionLocal);")),
new OpCode("binary", "Common instruction for add, sub, mul, div, rem, bit.and, bit.or, bit.xor, shl and shr.",
CustomClassName("BinaryNumericInstruction"), Binary, CustomWriteTo, CustomConstructor, CustomComputeFlags,
MatchCondition("CheckForOverflow == o.CheckForOverflow && Sign == o.Sign && Operator == o.Operator && IsLifted == o.IsLifted")),

Loading…
Cancel
Save