[pypy-dev] RPython question about the lifetime of global state

Lenard Lindstrom len-l at telus.net
Thu Mar 6 07:16:57 CET 2014


Hi everyone,

I am developing a new image blit system for Pygame 2.0 - the SDL2 
edition. A blitter prototype project is maintained at 
https://bitbucket.org/llindstrom/blitter. The prototype implements a 
blit loop JIT; Pixel format specific blit code is generated dynamically 
as needed. The prototype is written in RPython as an interpreter for 
executing array copies. The JIT comes automatically from the RPython 
tool chain, of course.

The prototype blitter is built as a stand-alone shared library with 
flags -Ojit --gcrootfinder=shadowstack. It has no Python dependencies. 
There are two entrypoint C functions, both decorated with 
rpython.rlib.entrypoint.entrypoint. Python side code uses CFFI to access 
the library. The library is initialized with a single call to 
rpython_startup_code at load time.

The blitter library is meant to be an embedded interpreter, with 
initialize, configure, and execute functions. So my question, does the 
RPython tool chained explicitly support embedded interpreters? I ask 
because I have only seen secondary entry points used as callbacks into 
an interpreter (PyPy's cpyext interface). So I wish to confirm that the 
lifetime of an RPython global namespace, the JIT caches, and the garbage 
collector are that of the loaded library, and not just that of an entry 
point function call.

Thanks in advance,

Lenard Lindstrom



More information about the pypy-dev mailing list