<br><br><div class="gmail_quote">On Thu, Apr 14, 2011 at 10:56 AM, Antonio Cuni <span dir="ltr"><<a href="mailto:anto.cuni@gmail.com">anto.cuni@gmail.com</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 14/04/11 16:44, Hakan Ardo wrote:<br>
> Second though, that will recompile on every call, but if we cache the<br>
> promote functions:<br>
><br>
> def main(n, promoters={}):<br>
> i, a = 0, 0<br>
> if n not in promoters:<br>
> exec """def promote(n):<br>
> assert n==%d""" % n<br>
> promoters[n] = promote<br>
> else:<br>
> promote = promoters[n]<br>
> while i < n:<br>
> promote(n)<br>
> a += i+5<br>
> i += 1<br>
> return a<br>
><br>
> we will actualy get rid of the extra ptr_eq and guard_false too...<br>
<br>
</div>wow, that's advanced... and without knowing the internals of the JIT, it<br>
really looks like black magic.<br>
<br>
While we are at it and if you have time/feel like, could you please have a<br>
look to test_zeropadded and test_circular in test_pypy_c_new? It's not clear<br>
to me what they are supposed to check (note that it's fine if you say "they<br>
just check that the program works correctly" :-)).<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
<a href="mailto:pypy-dev@codespeak.net">pypy-dev@codespeak.net</a><br>
<a href="http://codespeak.net/mailman/listinfo/pypy-dev" target="_blank">http://codespeak.net/mailman/listinfo/pypy-dev</a><br>
</div></div></blockquote></div><br>The idea of a builtin app level promote is cool, I guess it should be smart and unbox primitives though.<br><br>Alex<br clear="all"><br>-- <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>