<br><br><div class="gmail_quote">On Fri, Mar 30, 2012 at 9:15 AM, Hakan Ardo <span dir="ltr">&lt;<a href="mailto:hakan@debian.org">hakan@debian.org</a>&gt;</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 &lt;<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>&gt; wrote:<br>
&gt; I&#39;m a bit concerned that this branch may be breaking too many assumptions in<br>
&gt; the JIT with the current approach.  The idea of this branch is to<br>
&gt; dynamically specialize the shape of a tuple&#39;s memory, to store unboxed<br>
&gt; objects.  Based on the current approach (storing all data in an array of<br>
&gt; integers) you get traces that look like:<br>
&gt;<br>
&gt; p0 = new(&lt;untyped storage&gt;)<br>
&gt; setfield_gc(p0, ConstPtr(&quot;io&quot;), &lt;FieldDescr shape&gt;)<br>
&gt; setarrayitem_gc(p0, 0, i0, &lt;ArrayDescr int&gt;)<br>
&gt; setarrayitem_gc(p0, 1, p1, &lt;ArrayDescr ptr&gt;)<br>
&gt; finish(p0)<br>
&gt;<br>
&gt; This is a trace for allocating a tuple like (int1, ptr1) and returning it.<br>
&gt;  Do you think a trace like this breaks too many assumptions in the JIT, and<br>
&gt; 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 &lt; 3000:<br>
    sa += a[0] + a[1]<br>
    if sa &gt; 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>&quot;I disapprove of what you say, but I will defend to the death your right to say it.&quot; -- Evelyn Beatrice Hall (summarizing Voltaire)<br>&quot;The people&#39;s good is the highest law.&quot; -- Cicero<br>
<br>
</div>