Why doesn't JUMP_IF_FALSE do POP_TOP ?

Bengt Richter bokr at oz.net
Mon Jan 13 12:04:30 EST 2003


On Mon, 13 Jan 2003 10:48:30 -0500, "Terry Reedy" <tjreedy at udel.edu> wrote:

>
>> > Seems simple enough to add a new code that combines the two? That
>> > would avoid breaking old compiled code.
>>
>> Could add more than one; below is the inventory of conditional jump
>> opcodes from a you've-never-heard-of-it language. All of the opcodes
>> pop the stack first and jump depending on the popped value.
>
>When I asked about this in August one answer was that this should not
>be changed until the 'new compiler' is finished (it still is not)
>because adding an opcode would create foward/backward incompatibilites
>that are not justified by such a minor optimization.
>
Has anyone taken a measure of exactly how "minor" it really would be?

I.e., it should be simple to instrument ceval.c to extern link to a temp module
with an integer array indexed by byte code value to increment for statistics.
An interface to retrieve the array as a list of integers and resetting it to
zero would also be simple. Ditto for a bigger array indexed by ((current<<8)|last)
byte code so we could see statistics for paired sequences like JUMP_IF_FALSE,POP_TOP.

If this has not been done, it really seems like it ought to be before any revision
to the VM.

Regards,
Bengt Richter




More information about the Python-list mailing list