[pypy-dev] Re: infos from the berlin-sprint (was Re: Sprint results?)
hpk at trillke.net
Sun Oct 5 22:05:29 CEST 2003
[Florian Schulze Sun, Oct 05, 2003 at 09:21:59PM +0200]
> Just a few questions about this: As far as I can tell there is no script
> yet, which just takes a python file and generates Pyrex code, correct?
> What would be needed?
> - a way to get functions from a python module
> - build_flow from the flow object space which takes those functions and
> generates a graph
> - GenPyrex from genpyrex.py which takes that graph and emits a pyrex
Maybe i should have pointed out that we are not at the point where
pypy takes any (RPython) python function, let alone unrestricted python.
> I tried out the following with a normal python interpreter in the pypy/src
> >>> import pypy.objspace.flow
> >>> space = pypy.objspace.flow.Space()
> >>> import pypy.translator.genpyrex
> >>> def f():
> ... i = 0
> ... while i < 10:
> ... i = i + 1
> ... return i
it is interesting to then continue with:
>>> flow = space.build_flow(f)
>>> genpyx = pypy.translator.genpyrex.GenPyrex(flow)
>>> print genpyx.emitcode()
cdef int i_v4
cdef int i_v8
cdef int i_v1
cdef int i_v7
cdef int i_v2
cdef int i_v9
i_v1 = 0
i_v2 = i_v1 < 10
i_v4 = i_v1 + 1
i_v1 = i_v4
cinline "goto Label2;"
i_v7, i_v8 = i_v1, i_v2
i_v9 = i_v7
which means you also get the type information.
More information about the Pypy-dev