[Python-Dev] lnotab and the AST optimizer

Thomas Lee tom at vector-seven.com
Thu Jul 24 18:23:00 CEST 2008


Antoine Pitrou wrote:
> Thomas Lee <tom <at> vector-seven.com> writes:
>>> By the way, you were right about JUMP_IF_TRUE/JUMP_IF_FALSE. It's far 
>> too late. Apologies.
>>>> I'm still pretty sure this is the peepholer's doing,
>>>> Yes indeed.
>>>> Which is what's being achieved with the AST optimization I originally 
>> proposed, right?
>>>> Well, not exactly, your optimization eliminates the UNARY_NOT by swapping the
> if/else blocks, while the peepholer eliminates the UNARY_NOT by fusing it with
> the subsequent jump opcode. In this case it doesn't make much of a difference,
> but if there is only an "if" without an "else", the peepholer's optimization is
> still possible while yours is not.
>>
Unless a pass is injected into the if body, which will generate no 
additional bytecode and still have the same net effect.
> (bottom line: the peepholer is not dead!)
>>We'll see ;)
Thanks for all your help, I'm looking forward to getting my hands on 
that patch.
Cheers,
T


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /