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