[pypy-dev] Ideas on pypy architecture (ala tismer)

Arman Bostani arman at twinsun.com
Tue Feb 18 20:11:10 CET 2003


A long time ago I worked on a Prolog compiler which had the following
design.

* The system had an abstract machine specification which is analogous
   to the Python byte code instructions.

* There was a second, very low-level instruction set (called progol)
   which was essentially a set of macros from which assembly code was
   generated.  To port to a new architecture, new mappings for progol
   instructions were defined.

* The system was able to compile the abstract machine instructions
   directly to progol.  Also, a Prolog interpreter was written in
   progol.

Now I think Pypy might benefit from a similar architecture.  My
suggestion is as follows:

* Examine the entire C code base and come up with a low-level
   instruction set (let's call it pynoth).  As above, this instruction
   set would be just a bunch of macros but probably translated to C
   rather than assembly.

* Write a semi-automated converter (ala tismer) to translate the
   existing C code into pynoth.  Perhaps, if the pynoth code can retain
   comments and look semi-decent, the Python gods will accept to use it
   rather than the existing C code base.  If not, then we'd have to
   retranslate new/modified sources to pynoth as python changes.

* Develop a psyco-style code generator which generates pynoth instead
   of assembly.

* Over time, we can get rid of the hand-hacked pynoth code and rewrite
   much of the system in python.

-arman

-- 
Arman Bostani                            360 N. Sepulveda Blvd. #2055
Twin Sun Inc.                                    El Segundo, CA 90245
arman at twinsun.com            Tel: (310) 524-1800, Fax: (310) 524-1818



More information about the Pypy-dev mailing list