[pypy-dev] .py -> .pyc -> (.pyc2 + .so) ?

Bengt Richter bokr at oz.net
Sun Dec 11 17:40:21 CET 2011


Just musing -- if pypy can discover pure functions (or functions with simple static
global side effects) and the jit transforms them into machine code in a runtime memory-resident
image somewhere, could this image be transformed with some .so boilerplate and metadata
into a loadable module which could be discovered for use more or less like a .pyc that
corresponds to .py is used? Could the jit perhaps write into a memory-mapped file that
could be closed on exit to preserve the image for possible final post-processing into
a standard format .so full of ready-made functions and supporting data?

If suitable metadata were included, perhaps the .so could be loaded and used by a C or C++
program linking it? Meaning there would be a way to write a C-compatible "library" using pypy
and python module source syntax.

If you 'can never be sure' some function is suitable, could you pass pypy a support file
(e.g. -jit purefuncfile=thesupportfile) with a line per function specifying modulefile
and access path (maybe start with global functions only), asserting suitability?

Regards,
Bengt Richter





More information about the pypy-dev mailing list