[pypy-dev] Re: [ann] Minimal Python project

Samuele Pedroni pedronis at bluewin.ch
Thu Jan 16 13:57:02 CET 2003


From: "Christian Tismer" <tismer at tismer.com>
> > Will you give some thought to going to a tagged representation of
> > object references, and maybe a more traditional GC?  That way you
> > avoid a lot of memory traffic, and also don't have to adjust reference
> > counts every time you touch anything.
> >
> > I think these would give a big performance boost, and also would also
> > simplify the C API.  It might be possible to supply a compatibility
> > layer to make the old C API still useable.
>
> Can you give me a hint how this would be done?
> I have no experience with tagged representations,
> but if this can save so much, I should learn more
> about it.

this is a relevant survey paper:

http://citeseer.nj.nec.com/gudeman93representing.html

Representing Type Information in Dynamically Typed Languages

e.g.

integer in the range [-2**30,2**30-1] would be represented by their bit
patterns shifted left by 1 bit

all other objects would be boxed, and the address left shifted by 1 and ORed
with 1.

The fact that Python is slowly removing the long/integer separation can make
less disruptive such an approach.

OTOH I think such an approach would make the life a bit more complicated for
psyco when detecting that a datum has machine-size integer type, because such a
datum would be either in the first form _or_ a boxed (long) integer in the
larger range -2**31 2**31-1.

Another approach is to carry data around as a struct where both the tag and the
datum are machine words, this approach is AFAIK currently used in the Gwydion
Dylan compiler (www.gwydiondylan.org) originally developed at CMU.

regards.







More information about the Pypy-dev mailing list