<br><br><div class="gmail_quote">On Fri, Mar 30, 2012 at 9:15 AM, Hakan Ardo <span dir="ltr"><<a href="mailto:hakan@debian.org">hakan@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Fri, Mar 30, 2012 at 2:49 PM, Alex Gaynor <<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>> wrote:<br>
> I'm a bit concerned that this branch may be breaking too many assumptions in<br>
> the JIT with the current approach. The idea of this branch is to<br>
> dynamically specialize the shape of a tuple's memory, to store unboxed<br>
> objects. Based on the current approach (storing all data in an array of<br>
> integers) you get traces that look like:<br>
><br>
> p0 = new(<untyped storage>)<br>
> setfield_gc(p0, ConstPtr("io"), <FieldDescr shape>)<br>
> setarrayitem_gc(p0, 0, i0, <ArrayDescr int>)<br>
> setarrayitem_gc(p0, 1, p1, <ArrayDescr ptr>)<br>
> finish(p0)<br>
><br>
> This is a trace for allocating a tuple like (int1, ptr1) and returning it.<br>
> Do you think a trace like this breaks too many assumptions in the JIT, and<br>
> if so, how can we go about making the JIT work with this.<br>
<br>
</div>That part might be fine. In this case the descr depends is not realy<br>
changing it just depends on the constant index. The assert could<br>
probably be relaxed to allow that. But what would traces reading<br>
values from the tuple look like. In cases where the tuple may conatin<br>
different types or if the index is not constant? Say something like<br>
this:<br>
<br>
sa = 0<br>
a = (1, 2.0)<br>
while sa < 3000:<br>
sa += a[0] + a[1]<br>
if sa > 1500:<br>
a = (a[1], a[0])<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Håkan Ardö<br>
</font></span></blockquote></div><br>My idea is approximately you promote the shape whenever the index of a read is constant. Otherwise you produce a read on the shape, and a guard about the type.<div><br></div><div>Alex<br clear="all">
<div><br></div>-- <br>"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>"The people's good is the highest law." -- Cicero<br>
<br>
</div>