[pypy-dev] Work plan for PyPy

Armin Rigo arigo at tunes.org
Wed Jun 27 13:40:49 CEST 2007

Hi Richard,

On Mon, Jun 25, 2007 at 01:01:35PM -0700, Richard Emslie wrote:
> > Just a sidenote - rffi supports (and uses) macros. Not sure how this
> > will look like in a ctypes-based solution.
> if you are talking c macros - this could be very problematic for the  
> llvm backend.

Anton (which I add to the CC's of this mail) proposed a solution for
calling C APIs from llvm bytecode in a portable way, which would work
for functions whose argument types are not exactly specified by the
standards as well as for some kind of macros.  The idea is to generate
stub "helper" functions in C and compile them with llvm-gcc.  The llvm
bytecode that genllvm produces would then call the helper functions
instead of calling directly the external C API.  Shouldn't be a
performance problem as llvm will inline the helpers agressively.

Of course, it points again to the question of whether it's really
worthwhile to have an llvm backend in PyPy or if just producing C and
using llvm-gcc on everything wouldn't work just as well.  On the other
hand, it's interesting to note that there are other reasons for which
exactly the same kind of helper functions would be useful; for example,
to wrap a C library full of macros and unspecified types and constants,
ctypes alone is not enough.

A bientot,


More information about the Pypy-dev mailing list