[pypy-dev] Loop invaraints
william.leslie.ttg at gmail.com
Sun Aug 29 00:05:06 CEST 2010
The other part of the work is the algorithm that finds loop variants. It is
similar to the algorithm for variable colour inference, so you do have a
On 28/08/2010 11:12 PM, "Hakan Ardo" <hakan at debian.org> wrote:
some time ago, there were some discussion about loop invaraints, but
no conclusion. What do you think about the following approach:
- Let optimize_loop mark the arguments in loop.inputargs as invariant
if they appear at the same position in the jump instruction at the end
before calling propagate_formward
- Let the optimize_... methods emit operations that only uses
invariant arguments to some preamble instead of emitting them to
self.newoperations whenever that is safe. Also, the result of these
operations should probably be marked as invariant.
- Insert the created preamble at every point where the loop is called,
right before the jump.
- When compiling a bridge from a failing guard, run the the preamble
through propagate_formward and discard the emitted operations, to
inherit that part of the state of Optimizer.
This should place the invariant instructions at the end of the entry
bridge, which is a suitable place, right? At the end of a bridge from
a failing guard that maintains the invariants the optimizer should
remove the inserted preamble again, right? And at the end of a bridge
that invalidates them, enough of the preamble will be kept to maintain
correct behavior, right?
pypy-dev at codespeak.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pypy-dev