[pypy-dev] Pypy custom interpreter JIT question

Carl Friedrich Bolz cfbolz at gmx.de
Mon Mar 28 19:25:22 CEST 2011

On 03/28/2011 07:21 PM, Andrew Brown wrote:
> I tried that logging option once, but I didn't know how to read the
> logs. They're not exactly self explanatory. Is there a resource
> somewhere that explains how to read those logs?

Not really, no :-(

> Regardless, I've implemented your suggestion and moved reads from that
> dictionary to a function decorated with @purefunction. Indeed,
> performance is greatly improved! Thanks!
> Current version:
> https://bitbucket.org/brownan/bf-interpreter/src/d3394345272e/targetbf.py
> A few questions:
> When the optimizer encounters a "pure" function, it must compare the
> objects passed in to previous invocations... does it consider the
> contents of container or other mutatible objects? or just the object
> identity, to be part of the function's input?

Just the object's identity.

> It looks like, from logs of my new version, it's not reading from the
> dictionary at all during the trace, so I would guess it's not
> considering the actual contents of the dictionary as part of the
> function's input. This isn't surprising, but I just want to know for sure.
> Second, I noticed in jit.py the function hint() which has a parameter:
> "promote - promote the argument from a variable into a constant". Could
> this be an appropriate alternate to the @purefunction solution? Or, I'm
> guessing, does it just mean the name bracket_map won't change bindings,
> but does not impose a restriction on mutating the dictionary?

If you are interested, this blog series explains the usage of hints:


The logs there are a bit niceified though.

Carl Friedrich

More information about the Pypy-dev mailing list