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

Christian Tismer tismer at stackless.com
Thu Mar 31 18:58:40 CEST 2005


Armin Rigo wrote:

> Hi,
> 
> On Wed, Mar 30, 2005 at 07:48:43PM +0200, holger krekel wrote:
> 
>>(... C++ ...)
>>
>>Wouldn't this mean that we are barred from using "tcc" for
>>testing/debugging purposes? 
> 
> 
> That's an excellent point.
> 
> I played with a more promizing approach in
> http://codespeak.net/svn/pypy/dist/pypy/translator/typer.py .  Basically,
> instead of enhancing genc to support all kind of typed operations and implicit
> conversions (or rely on C++ to select the operations and insert these
> conversions automatically), the abvoe module contains code that modifies the
> flow graph itself to turn it into a "low-level" flow graph.  The idea was
> already floating around here.  In short it turns code like
> 
>   z = add(x, y)
> 
> into
> 
>   z = intadd(x, y)
> 
> if x and y are SomeIntegers, and it inserts int2obj() and obj2int() operations
> to convert variables that are SomeIntegers but used in operations that can't
> be special-cased (most of them, right now).
> 
> The idea is then that genc only needs minor updates to give various C types to
> the variables.  The operations like intadd() can be defined as a macro in
> genc.h, just like all the other operations.
> 
> The module is called "typer" because I guess that a clean solution would
> involve a dict that maps Variables and individual Constants to their C type,
> instead of relying implicitely on the SomeXxx annotations to mean particular C
> types.

Seems to be a nice idea, because it removes the burden of
handling such things from the generators.
I always wondered btw., why you have the annotation
data elsewhere. I would have augmented it to the block structure.
Changing the flow graph to contain the info is even more rude, but
very nice!

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/



More information about the Pypy-dev mailing list