[pypy-dev] Re: infos from the berlin-sprint (was Re: Sprint results?)
florian.proff.schulze at gmx.net
Sun Oct 5 21:21:59 CEST 2003
On Sun, 5 Oct 2003 18:36:32 +0200, holger krekel <hpk at trillke.net> wrote:
> Hi Florian,
First: Thanks to Laura and Holger for the replies!
> So alltogether the Flowgraph/Functiongraph/flowmodel (there is no
> completly fixed terminology yet) is the central point for several
> independent algorithms that - if combined - eventually produce typed
> To sum it up there are the following abstractions:
> interpreter interpreting bytecode, dispatching operations on objects
> objectspace implementing operations on boxed objects
> stdobjspace a concrete space implementing python's standard type
> flowobjspace a conrete space performing abstract/symbolic
> interpretation and
> producing a (bytecode-indepedent) flowmodel of execution
> annotator analysing the flowmodel to infer types.
> genpyrex taking the (annotated) flowmodel to generate pyrex-code
> pyrex translating into an C-extension
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
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
>>> print pypy.translator.genpyrex.GenPyrex(space.build_flow(f)).emitcode()
v21 = 0
v22 = v21 < 10
v24 = v21 + 1
v21 = v24
cinline "goto Label2;"
v27, v28 = v21, v22
v29 = v27
Which is quite impressive in my opinion.
More information about the Pypy-dev