Hi HÃ¥kan, thanks for taking up the topic.
On 08/28/2010 03:05 PM, Hakan Ardo wrote: > - 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 sounds good. > - 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. Need to be a bit careful about operations with side-effects, but basically yes. > - Insert the created preamble at every point where the loop is > called, right before the jump. This part makes sense to me. The code would have to be careful to match the variables in the trace and in the preamble. > - 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. ... but I don't see why this is needed. Wouldn't you rather need the whole trace of the loop including the preamble up to the failing guard? This would be bad, because you need to store the full trace then. > 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? Yes to all the questions, at least as fas as I can see. I guess in practice there might be complications. Cheers, Carl Friedrich P.S.: A bit unrelated, but a comment on the jit-bounds branch: I think it would be good if the bounds-related optimizations could move out of optimizeopt.py to their own file, because otherwise optimizeopt.py is getting really unwieldy. Does that make sense? _______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
