[Python-Dev] Why is Bytecode the way it is?

Skip Montanaro skip at pobox.com
Thu Jul 8 16:21:16 CEST 2004

    >> Python's VM is currently a stack machine.  There are arguments for
    >> making it a register machine, but if we want to do that, lets go the
    >> whole hog and not have some kind of half-assed hybrid.

    Paul> I'm not really talking about a register machine either. I don't
    Paul> understand why you would want to copy values from a heap in "main
    Paul> memory" into a register *still in main memory* to have the
    Paul> bytecodes operate on them to store to a register and then back to
    Paul> main memory.

When I looked at this a long time ago it I seem to recall that roughly 60%
of the opcodes executed did nothing more than copy values to or from the
stack (of course, pushes and pops are some of the more efficient opcodes in
the instruction set).  A three-address machine model would reduce this data
movement substantially.


More information about the Python-Dev mailing list