Daniel Grunwald
7d4252373c
Improve automatic variable names.
15 years ago
Daniel Grunwald
185e9e4331
Fix decompiling "this".
15 years ago
Daniel Grunwald
949e7c2378
Move decompiler code into ICSharpCode.Decompiler; add very simple integration with ILSpy.
15 years ago
David Srbecký
36f29f72e5
Moved everything into top-level directory
15 years ago
David Srbecký
69753642eb
Support for try-catch blocks
15 years ago
David Srbecký
eed0f0af6c
Refactoring the data model
15 years ago
David Srbecký
44e1258b5f
Updated decompiler to the new Cecil
15 years ago
David Srbecký
a26fd6c0b2
Decompiling class 'ReversiForm'.
...
Initial support for the switch bytecode
15 years ago
David Srbecký
edc9e53590
Stack analysis for methods that include exception handlers
15 years ago
David Srbecký
7b93f5762b
Constructors of multidimensional arrays.
...
Typing for setting an element of multidimensional array.
15 years ago
David Srbecký
b89018a214
Added class constructors
15 years ago
David Srbecký
4beea5c6a1
Completely rewritten ByteCodeExpressions.
...
It is now new representation of the code - that is, an extra stage in the decompilation process.
It is independent of the previous representation and thus it can be much more easily transformed.
15 years ago
David Srbecký
9f4dc8611d
Rename StackExpression to ByteCodeExpression
15 years ago
David Srbecký
f5a3052d23
generate code for dup
15 years ago
David Srbecký
15e2cd828a
Rename unknown bool variables to "flag".
15 years ago
David Srbecký
a87a9468e7
Track the type of expression.
...
Zero and One are tracked as special types so that they can be substituted with 'true' or 'false'.
15 years ago
David Srbecký
c3aedb0b3c
Preliminary support for multi-dimensional arrays
15 years ago
David Srbecký
3f268ec44f
ldsfld
...
stsfld
15 years ago
David Srbecký
059e91cdd9
Do not include explicit reference to 'this'
15 years ago
David Srbecký
6faf690899
Parenthesize all expression to ensure correctness.
15 years ago
David Srbecký
459742f3ca
Simplify short-circuit branches ("a && b" or "a || b").
...
Two new node types were created for this: SimpleBranch and ShortCircuitBranch.
The short-circuit branches are found by pattern finding - single short-circuit branch forms a specific triangular pattern in the control flow graph. Nested short-circuit branches are found by doing this node reduction repeatedly.
15 years ago
David Srbecký
e6269f491b
Moved jump reduction to the Ast transform phase
15 years ago
David Srbecký
eaa7a63343
castclass
15 years ago
David Srbecký
3ca49743ae
ldtoken
15 years ago
David Srbecký
49eeb49d1b
newobj
15 years ago
David Srbecký
6e7f51fad7
Property access. (Detect properties by naming convention; still needs to be done properly)
15 years ago
David Srbecký
57192a1fdc
stfld
15 years ago
David Srbecký
86ca89b055
callvirt
15 years ago
David Srbecký
6e4b542709
ldfld
15 years ago
David Srbecký
40e1edd7d9
Fixed all bugs that prevented the decompiler from running.
...
The output of decompilation is saved in file output.cs
Unsupported expressions are handled a bit more gracefully -
for example: IL__callvirt(set_AutoSize(), (IL__ldfld(titleLabel, @this )), 1);
this is will eventually become this.titleLabel.AutoSize = 1;
15 years ago
David Srbecký
af14439362
Terminating all optimizations with exceptions
15 years ago
David Srbecký
35f06e0a4b
Label is not reference counted object anymore, it is just a string. During transform we in two passes - find all live labels - remove all dead ones (the rest).
15 years ago
David Srbecký
479918e7bc
Remove MyBlockStatement.
15 years ago
David Srbecký
5b48611b69
Replace variable name for integers with "i", "j", "k", etc...
15 years ago
David Srbecký
af00ad101a
Restore for loop condition. It is a simple pattern match.
15 years ago
David Srbecký
d086b446e8
Remove flowing redundant jumps at the end of Ast blocks:
...
- Continue at the very end of loop
- Empty Return at the very end of method
- Goto at the very end of 'if' body, if the goto jumps right after the whole 'if' statement
15 years ago
David Srbecký
6ebd05c0fe
Simplify type names. For example replace "System.Console.WriteLine" with "Console.WriteLine" because we have a "using System;" statement. Replace "Int32" with "int", etc...
15 years ago
David Srbecký
8643290a4c
Remove redundant 'goto' statements in form:
...
goto labelX;
labelX: command();
15 years ago
David Srbecký
ecad71d802
Added custom Ast classes for Goto and Label statements that track the reference count of a label.
...
Added an Ast transform to remove dead labels. (first Ast transform in program, I expect many more to come. Some stuff should be rewritten to use these explicit transforms)
15 years ago
David Srbecký
45bedc8d1d
Try to reconstruct if statements. The following logic is used: Depending on the value of the condition, the control flow will branch to one of two locations - let's call then 'true entry' and 'false entry'. Nodes reachable *only* from the 'true entry' are assumed to be the 'true' body of the if statement. Similarly, nodes reachable only from the 'false entry' are the 'false' body. Nodes reachable from both 'true entry' and 'false entry' and not part of the if statement and are placed after it.
15 years ago
David Srbecký
356c0b0d2f
Completely rewritten the Node tree structure. It became increasingly difficult to maintain the node links (Predecessors, Successors) consistent during transformations. So rather then keeping them consistent I have implemented an algorithm that can calculate the Predecessors or Successors for any given node. There are a few caches on the way so that the calculation does not calculate everything again every time. Affected caches are automatically flushed when a tree structure changes. This is implemented using 'collection with events'.
15 years ago
David Srbecký
ff56995219
Reduce some 'goto's in loops to 'break' and 'continue'.
...
Do not output 'goto' for simple fall-through to next node.
15 years ago
David Srbecký
7df6c364c6
Non-conditional branch does not have 'fall-through' node as successor.
...
Add explicit 'goto' statement after each basic black.
More GUI debugging options.
15 years ago
David Srbecký
b310187433
GUI debugging controls
15 years ago
David Srbecký
693bb16488
Generate the initial graph.
...
Output the graph as nested blocks.
15 years ago
David Srbecký
0bff44d922
Create class for each node type
15 years ago
David Srbecký
faff1bf5a9
Working on graph reduction algorithm. (Graph creation and presentation is still missing)
15 years ago
David Srbecký
aba6b0950c
Split method body to basic blocks
15 years ago
David Srbecký
a43af72f9e
Bugfix - keep return if it is labelled.
15 years ago
David Srbecký
22494bde37
Define local variables when value is first assigned to them
15 years ago