Clone this wiki locally
newdecompiler branch of ILSpy is a re-design of the underlying decompiler engine (ICSharpCode.Decompiler).
The main objective of this redesign is to fix architectural deficits that cause the decompiler to generate incorrect code.
Examples of issues fixed by the new architecture:
- Invalid goto jumping into block
- Decompiled code calls incorrect overload due to missing cast
- Integer arithmetic uses wrong sign or size due to missing casts
The major changes in the new decompiler are:
- ILAst instructions now carry an IL stack type (
enum StackType), so the bit width of operations is known.
- ILAst instructions no longer use C# types; those are introduced only when converting ILAst->C#.
- ILAst instruction set is reduced and now has clear semantics for each operation.
- ILAst uses (extended) basic blocks for control flow.
- Many transforms now are run per-block, which solves a number of problems related to transform pass ordering.
- In debug builds, transform steps can be tracked via the
StepperAPI to visualize the decompilation process.
- Instead of
Cecil.TypeReference, the decompiler now uses the NRefactory TypeSystem.
- The required portions of ICSharpCode.NRefactory are included into ICSharpCode.Decompiler.
- ILSpy should be able to decompile itself, and still work when re-compiled from the decompiled code. (= correctness)
- Add back async/await decompilation, and other transform the old ILSpy that are not yet ported to the new decompiler. (= make decompiled code more pretty by using higher-level constructs)
- Add support for new code patterns used by the Roslyn C# compiler.
- Add support for C# 6 and 7 language features.
- Optimize the decompiler.