[pypy-dev] Object model

logistix logistix at zworg.com
Thu Feb 13 20:46:45 CET 2003

VanL <vlindberg at verio.net> wrote: 

> I think you are envisioning a model interpreter that works (more or 
> less) like the CPU works in a computer.  
>  CPUs, especially RISCy ones, usually work with essentially three things:
> 1. Operators (like iadd, fadd, imul, fdiv, or, xor, etc)
> 2. Registers
> 3. Immediate values

> It also might suggest a bootstrapping procedure:  
> 1. Start with the bytecode, rather than the compiler.  Treat the byte 
> code as "machine code" that we execute and CPython as the compiler.

A lot of the stuff he's talking about here is based on the existing
Python Interpreter.  It runs stack-based bytecode, where the stack
simply contains pointers to PyObjects.  It's also a little wierd
because it turns functions and stuff into code objects that get thrown
on the stack instead of trying to represent everything as a monolithic
block of memory where you would JSR to a memory address to call a
function.  Then these code objects can have their own embedded code

Since you seem to have a good low-level understanding of things,
checking out the documentation for the 'dis' module will show you all
the existing "assembly" instructions.

ceval.c has the actual implementation of the interpreter loop.

More information about the Pypy-dev mailing list