[Python-Dev] Register-based VM for CPython
solipsis at pitrou.net
Sun Nov 18 12:41:56 CET 2012
On Sat, 17 Nov 2012 11:17:40 +0100
Armin Rigo <arigo at tunes.org> wrote:
> Hi Victor,
> On Sat, Nov 17, 2012 at 2:13 AM, Victor Stinner
> <victor.stinner at gmail.com> 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). PyPy has similar
> > issues with its different garbage collector.
> That is not strictly correct. PyPy, Jython and IronPython have
> non-immediate destructors, but as far as I can tell they all avoid to
> keep objects alive for an unbounded amount of time. This important
> difference is visible if the function calls other code that takes a
> long while to run: in your approach, the objects created by the
> function itself will stay alive for the whole duration, while the
> other interpreters will all release them soon after they are not
> referenced any more --- not instantly like CPython but still soon.
Agreed with Armin.
Also, I would point out that the reference counting behaviour is an
important feature of *C*Python (to the point that we have test cases
checking against reference cycles), so we can't break it nilly-willy.
More information about the Python-Dev