[pypy-dev] [pypy-commit] pypy dynamic-specialized-tuple: kill an assert that doesn't hold now.

Hakan Ardo hakan at debian.org
Fri Mar 30 15:44:13 CEST 2012

On Fri, Mar 30, 2012 at 3:18 PM, Alex Gaynor <alex.gaynor at gmail.com> wrote:
>> sa = 0
>> a = (1, 2.0)
>> while sa < 3000:
>>    sa += a[0] + a[1]
>>    if sa > 1500:
>>        a = (a[1], a[0])
> My idea is approximately you promote the shape whenever the index of a read
> is constant.

But you would still need a guard about the type, right?

> Otherwise you produce a read on the shape, and a guard about
> the type.

These guards we'll need to be added to the virtualstate in the same
way as guards regarding the length of an array is treated. If those
guards are always explicit guards that should be simple. But if they
are implicit it might be tricky. By implicit I mean things like after
getarrayitem_gc(p0, 7) we will assume that the length of p0 is at
least 8.

The alternative is to not allow this kind of information to propagate
across loop boundaries, like we do with unerased pointers. In that
case the "guards" about the types are implied by the surrounding
rpython code and there is no way for the jit to extract the

> Alex
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
> "The people's good is the highest law." -- Cicero

Håkan Ardö

More information about the pypy-dev mailing list