[self-interest] Disassembling methods

Chris Double chris.double at double.co.nz
Wed Feb 10 05:07:02 UTC 2010


On 10/02/10 17:42, Russell Allen wrote:
> When I do it, the mirror I get has 'traits mirrors method' as a parent,
> which contains lots of nice behavior such as 'dissasemble' and 'codes'

Great, exactly what I wanted, thanks!

This seems to be the way to use methodDisassembler and other 
abstractBytecodeInterpreters:

tmp: methodDisassembler clone
tmp initializeForMethod: (reflect: traits string) first value
tmp interpretMethod

The result pf the 'interpretMethod' call in this case is the string of 
disassembled bytecodes (same as the 'dissasemble' method from your example).

replacing 'methodDisassembler' with 'branchTargetFinder' results in a 
different object returned from interpretMethod (a vector) which I assume 
is whatever that particular bytecode interpreter finds about the method.

That gives me a lot to go on, thanks.

Chris.
-- 
http://bluishcoder.co.nz



More information about the Self-interest mailing list