|
|
|
|
|
by userbinator
3985 days ago
|
|
Stack-based, high-level VMs like CLR, JVM, and Flash's AcriptScript are certainly quite easy to decompile, although I think this article unfortunately misses the point - it's full of (rather verbose) code, but little explanation. From what I can see it's very fragile too - it attempts to match exact instruction sequences so won't work for anything even slightly different from what's presented. This is equivalent to the test() method given, but won't get decompiled correctly: ldc.i4.4
ldarg.0
call System.Int32 Test1.AwesomeClass::c()
starg.s b
starg.s a
The right way to decompile a stack-based language requires keeping track of what's on the stack, building expressions instead of evaluating values.That InstructionHelper class also looks like it could be rewritten more clearly... |
|
There's also no discussion of type inferencing for variables, parenthesizing expression DAGs properly. I suspect properly decompiling control flow would be in part 2, but I'd be surprised if that were anywhere near robust, based on the quality demonstrated so far. Which is sad because this sort of decompilation has been practically demonstrated and solved for, oh, 10-20 years.