This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add OPpDEREFed flag to avoid double mg_get()
authorDavid Mitchell <davem@iabyn.com>
Tue, 25 May 2010 10:38:35 +0000 (11:38 +0100)
committerDavid Mitchell <davem@iabyn.com>
Tue, 25 May 2010 11:44:16 +0000 (12:44 +0100)
commit0824d66743a706cd268ace8fc9df03d7374c6886
tree7900aed8090cd6e812a8b8ee3156edf8e364bb81
parentbb1bc619ea68d9703fbd3fe5bc65ae000f90151f
add OPpDEREFed flag to avoid double mg_get()

    The previous commit made various ops such as rv2av unconditionally do
    an SvGETMAGIC(). Under some circumstances this could cause a double
    mg_get() (and hence double FETCH etc). In particular, when the
    proceeding op was something like aelem with OPpDEREF, the aelem would
    call vivify_ref(), which would call magic. So in peep(), mark
    OP_RV2[SAH]V ops with the new OPpDEREFed flag if the preceding op was
    OPpDEREF. Then use this flag to avoid a second dose of magic.

    Note that RV2GV probably needs this flag too, but there weren't any
    spare private flag bits left for that op (I think).
dump.c
ext/B/B/Concise.pm
ext/B/t/f_sort.t
op.c
op.h
pp.c
pp_hot.c