Commit Graph

  • bacab7a00b Idioms "i++" and "i += k" David Srbecký 2008-02-06 21:24:54 +0000
  • 3f268ec44f ldsfld stsfld David Srbecký 2008-02-06 20:57:06 +0000
  • 059e91cdd9 Do not include explicit reference to 'this' David Srbecký 2008-02-06 20:44:43 +0000
  • 10a96cf79f Include member reference and method invocation in precedence list. David Srbecký 2008-02-06 20:31:02 +0000
  • a284dd920d Remove parenthesis from: condition, assignment, variable definition David Srbecký 2008-02-06 20:15:53 +0000
  • 109d3f8649 Remove parenthesis that are not needed due to C# left associativity. David Srbecký 2008-02-06 19:56:04 +0000
  • 704a8c769e Remove some parenthesis that are not needed due to C# operator precedence. David Srbecký 2008-02-06 19:44:56 +0000
  • 0d3dd5de44 Apply the negation reduction twice. Also handle expressions in from "!!a" David Srbecký 2008-02-06 17:30:10 +0000
  • f1c1d34cba Simplify expressions by pushing negations inside. Includes application of De Morgan's laws. David Srbecký 2008-02-06 17:15:27 +0000
  • dacfade7df Remove parenthesis from primitive value, identifies and expression statements. David Srbecký 2008-02-06 15:35:10 +0000
  • 6faf690899 Parenthesize all expression to ensure correctness. David Srbecký 2008-02-06 15:25:05 +0000
  • 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. David Srbecký 2008-02-06 14:50:36 +0000
  • 7abcfaa3ed Conditional jumps now alone in basic block so that they can be expressed as single bool expression. David Srbecký 2008-02-02 21:26:25 +0000
  • cefcba99d1 When conditional does not have any common reachable nodes, create only 'true' body. 'False' body is then implicitly the code after the conditional. David Srbecký 2008-02-02 17:41:12 +0000
  • a455a6be02 Increased the reduction max count to 10000 David Srbecký 2008-02-02 16:10:08 +0000
  • 5b997bd44d Splitted the next statement finding algorithm to several reusable parts. David Srbecký 2008-02-02 15:59:11 +0000
  • 110defad02 The next statement for the end of loop is start of loop David Srbecký 2008-02-02 14:44:03 +0000
  • ba59de34fb When looking what follows a 'goto' statement, exit and enter code blocks. This simplifies code like: if (p) { Code(); goto Label; // This goto is redundant } for(;;) { Label: Code(); } David Srbecký 2008-02-02 14:10:58 +0000
  • e6269f491b Moved jump reduction to the Ast transform phase David Srbecký 2008-02-02 12:41:00 +0000
  • 3643debd61 The Target of decompilation is now Board. It has plenty of nested 'for' loops and 'if's. David Srbecký 2008-02-01 23:52:32 +0000
  • eaa7a63343 castclass David Srbecký 2008-02-01 23:23:52 +0000
  • 3ca49743ae ldtoken David Srbecký 2008-02-01 23:14:25 +0000
  • 49eeb49d1b newobj David Srbecký 2008-02-01 22:54:53 +0000
  • 6e7f51fad7 Property access. (Detect properties by naming convention; still needs to be done properly) David Srbecký 2008-02-01 22:47:33 +0000
  • 57192a1fdc stfld David Srbecký 2008-02-01 22:02:53 +0000
  • 86ca89b055 callvirt David Srbecký 2008-02-01 21:51:07 +0000
  • 6e4b542709 ldfld David Srbecký 2008-02-01 21:47:49 +0000
  • 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; David Srbecký 2008-02-01 21:42:11 +0000
  • bc89f0a071 Target of decompilation is now AboutDialog in the Reversi game. David Srbecký 2008-02-01 20:28:10 +0000
  • 42451cbd9d Added a Reversi game from http://www.codeproject.com/KB/game/reversi.aspx David Srbecký 2008-02-01 14:32:43 +0000
  • 48c25a5821 Progress Report - Draft 1 David Srbecký 2008-01-30 21:40:54 +0000
  • 3aa8cc498c Initial GUI options loaded loaded from class David Srbecký 2008-01-28 21:32:35 +0000
  • 598dcfd92c Bugfix in SimplifyTypeReferences - calling it for second time corrupted some type names David Srbecký 2008-01-28 21:30:49 +0000
  • af14439362 Terminating all optimizations with exceptions David Srbecký 2008-01-28 21:21:58 +0000
  • 27d8b0107d Include blocks jumping outside the parent not as being conditionals David Srbecký 2008-01-28 20:49:28 +0000
  • a95748dc66 More GUI options David Srbecký 2008-01-28 19:47:17 +0000
  • 27d70d6897 Reduce "String.Concat(a, b)" to "a + b" David Srbecký 2008-01-28 18:58:57 +0000
  • 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). David Srbecký 2008-01-28 18:25:25 +0000
  • 9aff0b724d Simplify the transform code by using extension methods. David Srbecký 2008-01-28 18:03:33 +0000
  • 479918e7bc Remove MyBlockStatement. David Srbecký 2008-01-28 17:21:12 +0000
  • ea50b09c0d NRefactory: Add NodeCollection.AddRange method David Srbecký 2008-01-28 17:20:01 +0000
  • 07a2cb2a84 NRefactory: Set parent of child when it is added to collection David Srbecký 2008-01-28 17:15:46 +0000
  • 932cf1a232 NRefactory: INode.Children type changed from List<T> to more general IList<T> David Srbecký 2008-01-28 17:12:38 +0000
  • e42166ca85 Add NRefactory source code David Srbecký 2008-01-28 16:10:14 +0000
  • 34c8127a9b Restore loop initializer David Srbecký 2008-01-28 14:30:00 +0000
  • 5b48611b69 Replace variable name for integers with "i", "j", "k", etc... David Srbecký 2008-01-28 14:02:39 +0000
  • 08528a768a Reduce 'if' statements in loops. David Srbecký 2008-01-27 23:43:05 +0000
  • 5b8b80cc72 Restore loop iterator - move assignment from the end of loop. David Srbecký 2008-01-27 23:13:37 +0000
  • af00ad101a Restore for loop condition. It is a simple pattern match. David Srbecký 2008-01-27 23:05:18 +0000
  • 075c5bebdb Remove empty 'else body' of 'if' statement. David Srbecký 2008-01-27 22:46:07 +0000
  • 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 David Srbecký 2008-01-27 22:26:00 +0000
  • 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... David Srbecký 2008-01-27 18:30:36 +0000
  • 8643290a4c Remove redundant 'goto' statements in form: goto labelX; labelX: command(); David Srbecký 2008-01-27 17:38:35 +0000
  • 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) David Srbecký 2008-01-27 15:43:40 +0000
  • 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. David Srbecký 2008-01-27 14:39:14 +0000
  • 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'. David Srbecký 2008-01-27 10:32:26 +0000
  • 7bf471eec3 Some set operations that will be need for 'if' simplification David Srbecký 2008-01-26 12:22:34 +0000
  • dda481d0fe Maintain node links at all levels, not just at the top one. David Srbecký 2008-01-26 11:44:09 +0000
  • ff56995219 Reduce some 'goto's in loops to 'break' and 'continue'. Do not output 'goto' for simple fall-through to next node. David Srbecký 2008-01-24 23:37:18 +0000
  • 7df6c364c6 Non-conditional branch does not have 'fall-through' node as successor. Add explicit 'goto' statement after each basic black. More GUI debugging options. David Srbecký 2008-01-24 21:28:49 +0000
  • b310187433 GUI debugging controls David Srbecký 2008-01-24 20:07:26 +0000
  • 693bb16488 Generate the initial graph. Output the graph as nested blocks. David Srbecký 2008-01-24 18:22:48 +0000
  • 0bff44d922 Create class for each node type David Srbecký 2008-01-24 16:41:06 +0000
  • faff1bf5a9 Working on graph reduction algorithm. (Graph creation and presentation is still missing) David Srbecký 2008-01-24 00:35:29 +0000
  • aba6b0950c Split method body to basic blocks David Srbecký 2008-01-23 21:23:13 +0000
  • a43af72f9e Bugfix - keep return if it is labelled. David Srbecký 2007-11-12 14:30:24 +0000
  • 22494bde37 Define local variables when value is first assigned to them David Srbecký 2007-11-12 14:23:40 +0000
  • 82d3debe87 Do not output the very last return statement David Srbecký 2007-11-12 13:19:36 +0000
  • 9eb2441490 Test on the compiler optimized version of quicksort David Srbecký 2007-11-12 01:28:06 +0000
  • 29b95cd28c Remove some parenthesis David Srbecký 2007-11-12 01:13:20 +0000
  • acdac3ecf5 Join consecutive expression together if possible David Srbecký 2007-11-12 01:01:29 +0000
  • 37d40932d9 Convert ByteCodeCollection to new data representation: StackExpressionCollection; Modify the generating code to use this data representation David Srbecký 2007-11-11 23:49:36 +0000
  • ed413b7ec3 Move stack analysis to the ByteCode class David Srbecký 2007-11-11 22:49:57 +0000
  • b7486c3221 Move StackBehaviour code to separate file David Srbecký 2007-11-11 21:48:29 +0000
  • 53eed43bf5 Moved typing code to ByteCode.GetType() David Srbecký 2007-11-11 21:42:03 +0000
  • 475eab39cf Move code from Util class to - ByteCode.PopCount - ByteCode.PushCount David Srbecký 2007-11-11 20:46:08 +0000
  • 0fe95f6b0b Use custom data structure to store bytecode sequence David Srbecký 2007-11-11 20:21:59 +0000
  • 9d82c6c55b Remove unnecessary labels David Srbecký 2007-11-11 17:59:59 +0000
  • 970706161a Get type of elements obtained from array David Srbecký 2007-11-11 17:53:56 +0000
  • a9ab824805 Get type for stack slots (partially implemented); Types are stored as Cecil TypeReferences David Srbecký 2007-11-11 17:33:11 +0000
  • ffef73b007 Hack - convert int to bool on == operator David Srbecký 2007-11-09 19:30:05 +0000
  • cfa3ecd70d Get type of new array David Srbecký 2007-11-09 17:28:59 +0000
  • 56ced90f95 Added "using System;"; Do not create namespace with empty name David Srbecký 2007-11-09 17:16:47 +0000
  • 2642e6de19 Output local variables David Srbecký 2007-11-09 17:03:27 +0000
  • 4468b4a3e1 Use stack analysis to figure out basic data flow - use actual inputs instead of the dummy ones David Srbecký 2007-11-09 16:49:32 +0000
  • 238605c831 Initial stack analysis implementation: Verify that the stack sizes are consistent - ie at a given location the stack size is statically known and constant. Keep track of instruction which pushed a given value on the stack. (Not handling the potential problem at control merge points - this problem does not occur in the quick sort algorithm) The state of the stack is outputted as a comment in the source code David Srbecký 2007-11-08 17:01:32 +0000
  • 306b17db33 Started a type checking algorithm David Srbecký 2007-11-04 17:09:03 +0000
  • 466e199cca Assign the result of each instruction to a temporary local variable David Srbecký 2007-11-04 16:08:06 +0000
  • e650e1afe6 Ldelema; Instance method calls David Srbecký 2007-11-04 15:44:33 +0000
  • 5032ab1df0 Implemented 'ret' instruction (function return) David Srbecký 2007-11-04 15:11:39 +0000
  • c57f053f7a Add a label in front of every statement David Srbecký 2007-11-04 14:57:17 +0000
  • 8faee275ed Implemented 'call' instruction David Srbecký 2007-11-04 14:35:23 +0000
  • 8bf08b1e1e Implemented branching operations David Srbecký 2007-11-04 14:15:02 +0000
  • fda3f6e0b5 Implemented comparison operators David Srbecký 2007-11-03 18:31:34 +0000
  • cc2d74dc94 Implemented basic array operations David Srbecký 2007-11-03 18:26:52 +0000
  • 6ee62de047 Finished arithmetic operations David Srbecký 2007-11-03 17:58:46 +0000
  • af3a01cd44 Rename files David Srbecký 2007-11-03 17:09:46 +0000
  • 7753b88bc5 Use NRefactory to create method bodies -> CodeDom not used anymore David Srbecký 2007-11-03 16:23:00 +0000
  • e5500abf75 Output the skeleton code using NRefactory instead of CodeDom David Srbecký 2007-11-03 15:37:41 +0000
  • 801a31f8d1 Generate code for some arithmetic operations (some operations are unsupported by CodeDom) David Srbecký 2007-10-31 19:28:48 +0000