[pypy-dev] Next step: gen???.py

Carl Friedrich Bolz cfbolz at gmx.de
Thu Mar 31 00:24:42 CEST 2005


hi all,

On 30 Mar 2005 19:48:43 +0200, Holger Krekel wrote:
> To me the current No. 1 criterium for the choice of backends is
> development-testing/round-trip speed.  And i would guess that both
> LLVM and genc both fare better than C++ in that respect.

Yup, LLVM compiles surprisingly fast though I didn't test any big programs
(On the other hand, I tried to compile CPython using the cfrontend of LLVM
and it felt at least as fast as GCC, too).

> Also, it would be interesting to hear from Carl what the current
> state of the LLVM backend is (all tests pass for me, btw, and
> Carl seems to have made quite some progress judging from
> the passing tests and the generated .ll files alone).

Ok, short list of things that work and things that don't:


things that work:
=================
 * ints, bools
 * lists (including range, some methods like append, pop, reverse)
 * strings (implemented as lists of chars)
 * classes with inheritance, basic polymorphism, isinstance checks


things that don't work but should be (relatively) easy:
=======================================================
 * exceptions (I'll tackle those next weekend)
 * multiple inheritance -- should be easy since only mixins are allowed
 * iterators
 * class attributes
 * floats
 * variable argument functions -- haven't thought about those
 * dicts -- it might be a bit more difficult to get them fast, though
 * SomeObjects: I'm now sure that I can link again CPython so maybe it's
   actually easy to support SomeObjects


things that don't work and are probably complicated:
====================================================
 * garbage collection -- ouch: There are GC hooks in LLVM but there is no   
   GC implemented. Some group of students tried implementing a GC at
   the end of last year but they didn't write to LLVM-dev since then.
 * I'm sure there is more but I can't think of it now


Some more points:

LLVM seems to be even more difficult to compile under Windows. I didn't
track that in all detail but a while ago there were quite some problems.

Furthermore I'm not sure whether there are that many advantages of LLVM over
C (or some sort of minimal C++) at this point. Most if not all of the things
I do with genllvm can be done in pretty much the same way with C and just as
easily (maybe except the stack unrolling for exceptions), especially if the
C++ features Armin mentiones are used. LLVM probably optimizes the code
better but if that's the issue we could use genc and compile with llvm-gcc.
The real strengths of LLVM come into play when the code is generated
dynamically -- which is not really the point at the moment, right?

All in all I can't really tell whether it's a good idea to make genllvm the
'first' backend.

Regards,

Carl Friedrich



More information about the Pypy-dev mailing list