[pypy-dev] compiler optimizations: collecting ideas
daniel.furrer at gmail.com
Mon Nov 17 16:04:57 CET 2008
Thanks for your answers.
On Mon, Nov 17, 2008 at 2:26 PM, Carl Friedrich Bolz <cfbolz at gmx.de> wrote:
> I guess the problem for "classical" compiler optimizations applied to a
> compiler producing Python bytecode is that most of them are potentially
> unsafe. E.g. you cannot do CSE in Python, because any expression can
> have arbitrary side-effects. Therefore it is very limited which
> optimizations can be applied at all.
Well, the side-effects are a problem, so we can not do any method
invocations (unless we would check that the methods are pure). Thinking
about this: it's not even easily possible to optimize the subset of
numerical operations because we don't have any static type information.
> PyPy's translation toolchain works in SSI as an intermediate
> representation (which is a sub-set of SSA). However, many of the
> straightforward optimizations (constant-folding, copy-progragation,
> inlining, a form of escape analysis) have already been implemented. Some
> things are not done yet, like common subexpression elimination. We
> didn't bother to implement them yet, because they are not as useful for
> PyPy since we target C, and most C compilers can do theses things for us.
That's true. But I would assume they do constant folding and copy
propagation as well then, don't they? (How about PRE?)
So just out of interest: In which area would you start optimizing PyPy?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pypy-dev