So there I was, reading my Dragon book again and thinking about
optimising Parrot bytecode. I took disassemble.pl, hacked it to
actually output source code that might compile, and gave it some
knowledge about operators, basic blocks, and flow graphs. And hooked
it up to Graphviz[1]. The code is real ugly, but the results is cute
so I'll share the picture.

It reads bytecode, this time of Greg's pasm for the Leibniz summation
for PI (see bottom of http://www.parrotcode.org/examples/) and outputs
a flow graph for the program:
http://astray.com/bb.png

Basic blocks are important as you should only do peephole
optimisations within them. Ignore if this is over your head. Enjoy the
pretty picture above and bear in mind that this will eventually turn
into a real bytecode optimiser for Parrot. Maybe.

Leon
 
[1] Inevitable, really
-- 
Leon Brocard.............................http://www.astray.com/
Nanoware...............................http://www.nanoware.org/

... "1001 Things To Do With Whipped Cream", LGLB (1995)

Reply via email to