In perl.git, the branch smoke-me/arc/pp-iter-deoptimisation has been created

<https://perl5.git.perl.org/perl.git/commitdiff/074f775584feb9a2c905c7d80be2aaca98ce0ee3?hp=0000000000000000000000000000000000000000>

        at  074f775584feb9a2c905c7d80be2aaca98ce0ee3 (commit)

- Log -----------------------------------------------------------------
commit 074f775584feb9a2c905c7d80be2aaca98ce0ee3
Author: Aaron Crane <a...@cpan.org>
Date:   Fri Apr 20 17:45:04 2018 +0200

    pp_hot.c: conditionally deoptimise pp_iter() when non-standard OP_AND 
op_ppaddr
    
    Commit 7c114860c0fa8ade5e00a4b609d2fbd11d5a494c introduced an optimisation
    in pp_iter(). Before the optimisation, pp_iter() pushed either &PL_SV_yes or
    &PL_sv_no to the stack, and returned the op_next in the obvious way.
    
    The optimisation takes advantage of the fact that the op_next of an OP_ITER
    always points to an OP_AND node, so pp_iter() now directly jumps to either
    the op_next or the op_other of the OP_AND as appropriate.
    
    The commit message also says this:
    
        It's possible that some weird optree-munging XS module may break this
        assumption. For now I've just added asserts that the next op is OP_AND
        with an op_ppaddr of Perl_pp_and; if that assertion fails, it may be
        necessary to convert pp_iter()s' asserts into conditional statements.
    
    However, Devel::Cover does change the op_ppaddr of the ops it can see, so
    the assertions on op_ppaddr were being tripped when Devel::Cover was run
    under a -DDEBUGGING Perl. But even if the asserts didn't trip, skipping the
    OP_AND nodes would prevent Devel::Cover from determining branch coverage in
    the way that it wants.
    
    This commit converts the asserts into conditional statements, as outlined in
    the commit message above, and undoes the optimisation when the op_ppaddr
    doesn't match.

-----------------------------------------------------------------------

-- 
Perl5 Master Repository

Reply via email to