diff options
author | David Mitchell <davem@iabyn.com> | 2015-03-19 10:02:00 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2015-03-19 10:02:00 +0000 |
commit | 614f287fa3161d8ddf39319ce704cae53fd8c1ed (patch) | |
tree | 80327f383d71d21e082f2990a0f32b43fb5b0e14 /universal.c | |
parent | 3ef130ce58efa646d6a4faf8f2930fd19aaaab9f (diff) | |
download | perl-614f287fa3161d8ddf39319ce704cae53fd8c1ed.tar.gz |
universal.c: remove all trace of op_sibling
The OpSIBLING() macro and op_sibling_splice() are a higher-level
way of manipulating optrees that ensure portability in the face of
PERL_OP_PARENT etc.
This commit also helps with the lofty goal of nothing outside of op.c
directly accessing the op_sibling field.
This is a follow-on/improvement to bac7a184cda7b.
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/universal.c b/universal.c index db20cd6acb..f05f40a775 100644 --- a/universal.c +++ b/universal.c @@ -1049,6 +1049,7 @@ optimize_out_native_convert_function(pTHX_ OP* entersubop, * The code is mostly just cargo-culted from Memoize::Lift */ OP *pushop, *argop; + OP *parent; SV* prototype = newSVpvs("$"); PERL_UNUSED_ARG(protosv); @@ -1056,27 +1057,28 @@ optimize_out_native_convert_function(pTHX_ OP* entersubop, assert(entersubop->op_type == OP_ENTERSUB); entersubop = ck_entersub_args_proto(entersubop, namegv, prototype); + parent = entersubop; SvREFCNT_dec(prototype); pushop = cUNOPx(entersubop)->op_first; if (! OpHAS_SIBLING(pushop)) { + parent = pushop; pushop = cUNOPx(pushop)->op_first; } - argop = pushop->op_sibling; + argop = OpSIBLING(pushop); /* Carry on without doing the optimization if it is not something we're * expecting, so continues to work */ if ( ! argop || ! OpHAS_SIBLING(argop) - || OpHAS_SIBLING(argop->op_sibling) + || OpHAS_SIBLING(OpSIBLING(argop)) ) { return entersubop; } - pushop->op_sibling = argop->op_sibling; - argop->op_sibling = NULL; - argop->op_lastsib = 1; + /* cut argop from the subtree */ + (void)op_sibling_splice(parent, pushop, 1, NULL); op_free(entersubop); return argop; |