[pypy-dev] Re: Information from the FlowObjSpace

Michael Hudson mwh at python.net
Thu Apr 13 11:17:56 CEST 2006

"Brian C. Lum" <bclum at cs.ucsd.edu> writes:

> Hi,
> Thank you for the reply.  I have looked at model.py and I can make a
> FunctionGraph.  However, I am still not sure how to use it.
> space = FlowObjSpace()
> graph = space.build_flow(test.is_perfect_number)
> fun = FunctionGraph(test.is_perfect_number, graph.startblock)
> That is how I create an instance of FunctionGraph, and I can still
> make the blocks into an iterator, but I still cannot see what is
> inside the blocks, i.e. what would be the code in the function graph.
> Basically, all I want is a flowgraph of the code so that I can try to
> perform some static analysis on it (I want to bound the length of
> lists at compile time).  I cannot figure out how to access the
> instructions in each basic block from the flowgraph.

for block in graph.iterblocks():
    for op in block.operations:
        print op


  In the 1950s and 60s there was a regular brain drain of young
  Australians from the cities to London, but it was because of 
  money, culture and opportunity, not spiders.
           -- Al Grant, ucam.chat, from Owen Dunn's review of the year

More information about the Pypy-dev mailing list