[Vm-dev] squeak decompiler
Whiter Walt
whiter.walt at gmail.com
Mon Oct 20 12:57:42 UTC 2014
Hi,
thanks for your reply!
it is a pity, there is no documentation about decompiling. Anyway,
thanks for your summary/introduction about decompiling squeak bytecode...
Regards,
Walt
Am 20.10.2014 11:31, schrieb Clément Bera:
>
>
>
> Hello,
>
> I don't think there's much documentation available.
>
> Basically it builds a method AST from a compiled method. It is
> composed of the Decompiler that walks over the bytecode and the AST
> constructor that builds the AST.
>
> Most nodes maps one to one to AST nodes and are easy to decompile. The
> main complexity comes from the decompilation of inlined control flow
> structures, which is based on heuristics:
> - loops are decompiled to while loops and if a certain pattern is met
> (there's an iterator incremented at each loop iteration) then the
> while loop is replaced by #to:do: or #to:by:do:
> - conditions are decompiled to ifTrue:ifFalse:, except if the pattern
> matches a #ifNil:ifNotNil: (there's == nil bytecodes), and except if
> the conditional jumps jumps to a push true or push false bytecode, in
> which case it is decompiled to #and: or #or:
> - dup mixed with jumps are decompiled to #caseOf: or #caseOf:otherwise:
>
> There's a little complexity from cascade too. They're detected with
> dup bytecode without jumps on the contrary to #caseOf: .
>
> Note that the Decompiler is unreliable, recompiling the whole image
> from decompiled sources crashes, and seemingly it has not been
> possible to do that in the past decade (it was possible in Smalltalk
> 80). So you can consider that the decompiler can decompile 99% of
> methods but not all of them.
>
> An interesting work would be to improve the decompiler so that the
> image does not crash when all the methods are recompiled from
> decompiled sources.
>
> Regards,
>
> Clement
>
>
> 2014-10-20 10:51 GMT+02:00 Whiter Walt <whiter.walt at gmail.com
> <mailto:whiter.walt at gmail.com>>:
>
>
> Hi,
>
> I am interested in the Squeak Decompiler class. Is there any
> technical information in the net, which explains the
> functionality? Or maybe it follows some common "rules", I can find
> in some paper or book?
>
> cheers
> Walt
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20141020/7dd6b6ee/attachment.htm
More information about the Vm-dev
mailing list