This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
wrap op_sibling field access in OP_SIBLING* macros
authorDavid Mitchell <davem@iabyn.com>
Tue, 10 Jun 2014 12:54:13 +0000 (13:54 +0100)
committerDavid Mitchell <davem@iabyn.com>
Tue, 8 Jul 2014 15:40:03 +0000 (16:40 +0100)
commit1ed44841e79d19d36361c250aecabc75154c999c
treefe39d432a2af6a50d6817d6747dd70fcfb3b21f4
parent26443f8e448912975ced96860e4f51a9e1fbbaca
wrap op_sibling field access in OP_SIBLING* macros

Remove (almost all) direct access to the op_sibling field of OP structs,
and use these three new macros instead:

    OP_SIBLING(o);
    OP_HAS_SIBLING(o);
    OP_SIBLING_set(o, new_value);

OP_HAS_SIBLING is intended to be a slightly more efficient version of
OP_SIBLING when only boolean context is needed.

For now these three macros are just defined in the obvious way:

    #define OP_SIBLING(o)          (0 + (o)->op_sibling)
    #define OP_HAS_SIBLING(o)      (cBOOL((o)->op_sibling))
    #define OP_SIBLING_set(o, sib) ((o)->op_sibling = (sib))

but abstracting them out will allow us shortly to make the last pointer in
an op_sibling chain point back to the parent rather than being null, with
a new flag indicating whether this is the last op.

Perl_ck_fun() still has a couple of direct uses of op_sibling, since it
takes the field's address, which is not covered by these macros.
18 files changed:
dist/IO/IO.pm
dist/IO/IO.xs
dump.c
ext/B/B.pm
ext/B/B.xs
ext/Devel-Peek/Peek.pm
ext/Devel-Peek/Peek.xs
ext/XS-APItest/APItest.xs
ext/arybase/arybase.pm
ext/arybase/arybase.xs
op.c
op.h
pp_ctl.c
pp_sort.c
regcomp.c
regexec.c
sv.c
util.c