Skip to content

Commit d2d1c33

Browse files
committed
Fix #3070 stack order on block reimport
1 parent 5206aef commit d2d1c33

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ICSharpCode.Decompiler/IL/ILReader.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public bool MergeStackTypes(ImmutableStack<ILVariable> newEdge)
104104
a = a.Pop();
105105
b = b.Pop();
106106
}
107+
output.Reverse(); // restore correct stack order
107108
this.InputStack = ImmutableStack.CreateRange(output);
108109
this.ImportStarted = false;
109110
return true;
@@ -492,6 +493,7 @@ void ReadBlock(ImportedBlock block, CancellationToken cancellationToken)
492493
block.ResetForReimport();
493494
block.ImportStarted = true;
494495
reader.Offset = block.StartILOffset;
496+
//Debug.WriteLine($"Import block at IL_{block.StartILOffset:x4} with inputs {string.Join(", ", block.InputStack.Select(v => v.StackType.ToString()))}");
495497
currentBlock = block;
496498
currentStack = block.InputStack;
497499
// Read instructions until we reach the end of the block.

0 commit comments

Comments
 (0)