Hi all,

Countrary to what is written in the STM/AME proposal, since last week I
believe it might be (reasonably) possible to apply the same techniques
to CPython.  For now I am experimenting with applying them in a simple
CPython-like interpreter.  If it works, it might end up as a patch to
the core parts of CPython.  The interesting property is that it would
still be able to run unmodified C extension modules --- the Python code
gets the benefits of multi-core STM/AME only if it involves only the
patched parts of the C code, but in all cases it still works correctly.
(Moreover the performance hit is well below 2x, more like 20%.)

I did not try to hack CPython so far, but only a custom interpreter for
a Lisp language, whose implementation should be immediately familiar to
anyone who knows CPython C code: https://bitbucket.org/arigo/duhton .
The non-standard built-in function is "transaction", which schedules a
transaction to run later.

The code contains the necessary tweaks to reference counting, and seems
to work on all examples, but leaks some of the objects so far.  Fixing
this directly might be possible, but I'm not sure yet (it might require
interaction with the cycle-detecting GC of CPython).

If anyone is interested, I could create a different mailing list in
order to discuss this in more details, as it's only related to PyPy on
the original idea level.  From experience I would think that this has
the potential to become a Psyco-like experiment, but unlike 10 years
ago, today I'm not ready any more to dive completely alone into a
project of that scale :-)


A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to