[Python-Dev] Register-based VM for CPython

Serhiy Storchaka storchaka at gmail.com
Sun Nov 18 14:58:33 CET 2012


On 17.11.12 03:13, Victor Stinner wrote:
> The major drawback of the register approach (at least of my
> implementation) is that it changes the lifetime of objects. Newly
> created objects are only "destroyed" at the exit of the function,
> whereas the stack-based VM destroys "immediatly" objects (thanks to the
> reference counter).

It should not be a problem. Just register instructions should clear 
input registers if they are not binded to named local variables. I.e. "a 
= b + c * d" should be compiled to:

    BINARY_MUL_REG       R1, 'c', 'd'
    BINARY_ADD_REG       'a', 'b', R1 # R1 cleared




More information about the Python-Dev mailing list