[pypy-dev] Information from the FlowObjSpace
Christian Tismer
tismer at stackless.com
Thu Apr 13 04:39:41 CEST 2006
Brian C. Lum wrote:
> Dear Pypy developers:
>
> I have gone through the source code for the FlowObjSpace in
> pypy.objspace.flow.objspace, but I am confused how to traverse through
> the blocks or obtain the information for each blocks in the graph. From
> my understanding:
>
> space = FlowObjSpace()
> graph = space.build_flow(func)
>
> Once you have the graph, however, how do you know what instructions are
> in each block? I can iterate through the graph with iterblocks, but how
> do I get information from each block?
>
> I want to analyze the information in each block to do code analysis for
> python. Can anyone help me with this?
First of all, flowing doesn't work for full CPython. You need
to use the RPython subset (see
http://codespeak.net/pypy/dist/pypy/doc/coding-guide.html#restricted-python
)
Then, if you have a block, you can iterate over block.operations
which is a list, and so on. See pypy/objspace/flow/model.py
ciao - chris
--
Christian Tismer :^) <mailto:tismer at stackless.com>
tismerysoft GmbH : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Pypy-dev
mailing list