[issue1394] simple patch, improving unreachable bytecode removing

Alexander Belopolsky report at bugs.python.org
Tue Feb 26 00:37:29 CET 2008


Alexander Belopolsky added the comment:

Attached patch adds test_elim_unreachable() unit test.  Last two 
assertions should fail with unpatched python.

I am still trying to convince myself that the transformation are 
correct.

> I propose that codestr[] array is made one byte
> longer and RETURN_VALUE opcode wrote in that extra byte.

I don't think that will be correct.  Did you consider the following 
comment?

        /* Verify that RETURN_VALUE terminates the codestring.  This 
allows 
           the various transformation patterns to look ahead several 
           instructions without additional checks to make sure they are 
not 
           looking beyond the end of the code string. 
        */ 
        if (codestr[codelen-1] != RETURN_VALUE) 
                goto exitUnchanged;

Added file: http://bugs.python.org/file9555/test_peepholer.diff

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1394>
__________________________________


More information about the Python-bugs-list mailing list