summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-04-17 16:52:20 +0100
committerDavid Mitchell <davem@iabyn.com>2015-04-19 18:42:00 +0100
commit87b5a8b9c803ae59e56e2a94a73f566e632038ad (patch)
tree84fb39e140bd9981d650d54a346d46ced1e73d2b
parent86cd3a13b6713cc9d8406c9316fe126788e2497f (diff)
downloadperl-87b5a8b9c803ae59e56e2a94a73f566e632038ad.tar.gz
rename op_lastsib to op_moresib, and invert logic
Rather than having a flag which indicates that there are no more siblings, have a flag which indicates that there are more siblings. This flag was only introduced during the current blead cycle, so no production releases know about it.
-rw-r--r--dump.c2
-rw-r--r--ext/B/B.pm2
-rw-r--r--ext/B/B.xs8
-rw-r--r--ext/B/t/b.t4
-rw-r--r--ext/Devel-Peek/t/Peek.t16
-rw-r--r--op.c32
-rw-r--r--op.h10
-rw-r--r--pod/perlguts.pod2
8 files changed, 38 insertions, 38 deletions
diff --git a/dump.c b/dump.c
index 52d897fa5d..802dddf836 100644
--- a/dump.c
+++ b/dump.c
@@ -844,7 +844,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
if (o->op_savefree) sv_catpvs(tmpsv, ",SAVEFREE");
if (o->op_static) sv_catpvs(tmpsv, ",STATIC");
if (o->op_folded) sv_catpvs(tmpsv, ",FOLDED");
- if (o->op_lastsib) sv_catpvs(tmpsv, ",LASTSIB");
+ if (o->op_moresib) sv_catpvs(tmpsv, ",MORESIB");
Perl_dump_indent(aTHX_ level, file, "FLAGS = (%s)\n",
SvCUR(tmpsv) ? SvPVX_const(tmpsv) + 1 : "");
}
diff --git a/ext/B/B.pm b/ext/B/B.pm
index e8c45ee24f..0a7727cec0 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -15,7 +15,7 @@ require Exporter;
# walkoptree comes from B.xs
BEGIN {
- $B::VERSION = '1.57';
+ $B::VERSION = '1.58';
@B::EXPORT_OK = ();
# Our BOOT code needs $VERSION set, and will append to @EXPORT_OK.
diff --git a/ext/B/B.xs b/ext/B/B.xs
index b9885c37da..e8698c5ae3 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -760,7 +760,7 @@ const struct OP_methods {
{ STR_WITH_LEN("static"), op_offset_special, 0, },/*49*/
# if PERL_VERSION >= 19
{ STR_WITH_LEN("folded"), op_offset_special, 0, },/*50*/
- { STR_WITH_LEN("lastsib"), op_offset_special, 0, },/*51*/
+ { STR_WITH_LEN("moresib"), op_offset_special, 0, },/*51*/
{ STR_WITH_LEN("parent"), op_offset_special, 0, },/*52*/
# endif
#endif
@@ -1060,7 +1060,7 @@ next(o)
B::OP::savefree = 48
B::OP::static = 49
B::OP::folded = 50
- B::OP::lastsib = 51
+ B::OP::moresib = 51
B::OP::parent = 52
B::METHOP::first = 53
B::METHOP::meth_sv = 54
@@ -1146,7 +1146,7 @@ next(o)
case 49: /* B::OP::static */
#if PERL_VERSION >= 19
case 50: /* B::OP::folded */
- case 51: /* B::OP::lastsib */
+ case 51: /* B::OP::moresib */
#endif
#endif
/* These are all bitfields, so we can't take their addresses */
@@ -1157,7 +1157,7 @@ next(o)
: ix == 48 ? o->op_savefree
: ix == 49 ? o->op_static
: ix == 50 ? o->op_folded
- : ix == 51 ? o->op_lastsib
+ : ix == 51 ? o->op_moresib
: o->op_spare)));
break;
case 33: /* B::LISTOP::children */
diff --git a/ext/B/t/b.t b/ext/B/t/b.t
index 76b70896be..c382b421c9 100644
--- a/ext/B/t/b.t
+++ b/ext/B/t/b.t
@@ -483,8 +483,8 @@ SKIP: {
my $first = $lineseq->first;
my $second = $first->sibling;
is(ref $second->sibling, "B::NULL", 'op_parent: second sibling is null');
- is($first->lastsib, 0 , 'op_parent: first sibling: !lastsib');
- is($second->lastsib, 1, 'op_parent: second sibling: lastsib');
+ is($first->moresib, 1 , 'op_parent: first sibling: moresib');
+ is($second->moresib, 0, 'op_parent: second sibling: !moresib');
is($$lineseq, ${$first->parent}, 'op_parent: first sibling okay');
is($$lineseq, ${$second->parent}, 'op_parent: second sibling okay');
}
diff --git a/ext/Devel-Peek/t/Peek.t b/ext/Devel-Peek/t/Peek.t
index e35930b987..56522af1e8 100644
--- a/ext/Devel-Peek/t/Peek.t
+++ b/ext/Devel-Peek/t/Peek.t
@@ -1489,40 +1489,40 @@ dumpindent is 4 at -e line 1.
{
1 TYPE = leave ===> NULL
TARG = 1
- FLAGS = (VOID,KIDS,PARENS,SLABBED,LASTSIB)
+ FLAGS = (VOID,KIDS,PARENS,SLABBED)
PRIVATE = (REFC)
REFCNT = 1
{
2 TYPE = enter ===> 3
- FLAGS = (UNKNOWN,SLABBED)
+ FLAGS = (UNKNOWN,SLABBED,MORESIB)
}
{
3 TYPE = nextstate ===> 4
- FLAGS = (VOID,SLABBED)
+ FLAGS = (VOID,SLABBED,MORESIB)
LINE = 1
PACKAGE = "t"
}
{
5 TYPE = entersub ===> 1
TARG = 1
- FLAGS = (VOID,KIDS,STACKED,SLABBED,LASTSIB)
+ FLAGS = (VOID,KIDS,STACKED,SLABBED)
PRIVATE = (TARG)
{
6 TYPE = null ===> (5)
(was list)
- FLAGS = (UNKNOWN,KIDS,SLABBED,LASTSIB)
+ FLAGS = (UNKNOWN,KIDS,SLABBED)
{
4 TYPE = pushmark ===> 7
- FLAGS = (SCALAR,SLABBED)
+ FLAGS = (SCALAR,SLABBED,MORESIB)
}
{
8 TYPE = null ===> (6)
(was rv2cv)
- FLAGS = (SCALAR,KIDS,SLABBED,LASTSIB)
+ FLAGS = (SCALAR,KIDS,SLABBED)
PRIVATE = (0x1)
{
7 TYPE = gv ===> 5
- FLAGS = (SCALAR,SLABBED,LASTSIB)
+ FLAGS = (SCALAR,SLABBED)
GV_OR_PADIX
}
}
diff --git a/op.c b/op.c
index 4a920da5c8..c83cf846ca 100644
--- a/op.c
+++ b/op.c
@@ -297,9 +297,9 @@ Perl_Slab_Alloc(pTHX_ size_t sz)
DEBUG_S_warn((aTHX_ "allocating op at %p, slab %p", (void*)o, (void*)slab));
gotit:
- /* lastsib == 1, op_sibparent == 0 implies a solitary unattached op */
- o->op_lastsib = 1;
#ifdef PERL_OP_PARENT
+ /* moresib == 0, op_sibling == 0 implies a solitary unattached op */
+ assert(!o->op_moresib);
assert(!o->op_sibparent);
#endif
@@ -1216,7 +1216,7 @@ you to delete zero or more sequential nodes, replacing them with zero or
more different nodes. Performs the necessary op_first/op_last
housekeeping on the parent node and op_sibling manipulation on the
children. The last deleted node will be marked as as the last node by
-updating the op_sibling/op_sibparent or op_lastsib field as appropriate.
+updating the op_sibling/op_sibparent or op_moresib field as appropriate.
Note that op_next is not manipulated, and nodes are not freed; that is the
responsibility of the caller. It also won't create a new list op for an
@@ -1281,7 +1281,7 @@ Perl_op_sibling_splice(OP *parent, OP *start, int del_count, OP* insert)
last_del = OpSIBLING(last_del);
rest = OpSIBLING(last_del);
OpSIBLING_set(last_del, NULL);
- last_del->op_lastsib = 1;
+ last_del->op_moresib = 0;
}
else
rest = first;
@@ -1291,14 +1291,14 @@ Perl_op_sibling_splice(OP *parent, OP *start, int del_count, OP* insert)
while (OpHAS_SIBLING(last_ins))
last_ins = OpSIBLING(last_ins);
OpSIBLING_set(last_ins, rest);
- last_ins->op_lastsib = rest ? 0 : 1;
+ last_ins->op_moresib = rest ? 1 : 0;
}
else
insert = rest;
if (start) {
OpSIBLING_set(start, insert);
- start->op_lastsib = insert ? 0 : 1;
+ start->op_moresib = insert ? 1 : 0;
}
else {
cLISTOPx(parent)->op_first = insert;
@@ -1326,7 +1326,7 @@ Perl_op_sibling_splice(OP *parent, OP *start, int del_count, OP* insert)
cLISTOPx(parent)->op_last = lastop;
if (lastop) {
- lastop->op_lastsib = 1;
+ lastop->op_moresib = 0;
#ifdef PERL_OP_PARENT
lastop->op_sibparent = parent;
#endif
@@ -1411,7 +1411,7 @@ S_alloc_LOGOP(pTHX_ I32 type, OP *first, OP* other)
while (kid && OpHAS_SIBLING(kid))
kid = OpSIBLING(kid);
if (kid) {
- kid->op_lastsib = 1;
+ kid->op_moresib = 0;
#ifdef PERL_OP_PARENT
kid->op_sibparent = (OP*)logop;
#endif
@@ -4498,10 +4498,10 @@ Perl_op_append_list(pTHX_ I32 type, OP *first, OP *last)
if (last->op_type != (unsigned)type)
return op_append_elem(type, first, last);
- ((LISTOP*)first)->op_last->op_lastsib = 0;
+ ((LISTOP*)first)->op_last->op_moresib = 1;
OpSIBLING_set(((LISTOP*)first)->op_last, ((LISTOP*)last)->op_first);
((LISTOP*)first)->op_last = ((LISTOP*)last)->op_last;
- ((LISTOP*)first)->op_last->op_lastsib = 1;
+ ((LISTOP*)first)->op_last->op_moresib = 0;
#ifdef PERL_OP_PARENT
((LISTOP*)first)->op_last->op_sibparent = first;
#endif
@@ -4642,7 +4642,7 @@ S_force_list(pTHX_ OP *o, bool nullit)
/* manually detach any siblings then add them back later */
rest = OpSIBLING(o);
OpSIBLING_set(o, NULL);
- o->op_lastsib = 1;
+ o->op_moresib = 0;
}
o = newLISTOP(OP_LIST, 0, o, NULL);
if (rest)
@@ -4698,7 +4698,7 @@ Perl_newLISTOP(pTHX_ I32 type, I32 flags, OP *first, OP *last)
listop->op_last = last;
if (type == OP_LIST) {
OP* const pushop = newOP(OP_PUSHMARK, 0);
- pushop->op_lastsib = 0;
+ pushop->op_moresib = 1;
OpSIBLING_set(pushop, first);
listop->op_first = pushop;
listop->op_flags |= OPf_KIDS;
@@ -4706,9 +4706,9 @@ Perl_newLISTOP(pTHX_ I32 type, I32 flags, OP *first, OP *last)
listop->op_last = pushop;
}
if (first)
- first->op_lastsib = 0;
+ first->op_moresib = 1;
if (listop->op_last) {
- listop->op_last->op_lastsib = 1;
+ listop->op_last->op_moresib = 0;
#ifdef PERL_OP_PARENT
listop->op_last->op_sibparent = (OP*)listop;
#endif
@@ -4966,7 +4966,7 @@ Perl_newBINOP(pTHX_ I32 type, I32 flags, OP *first, OP *last)
else {
binop->op_private = (U8)(2 | (flags >> 8));
OpSIBLING_set(first, last);
- first->op_lastsib = 0;
+ first->op_moresib = 1;
}
#ifdef PERL_OP_PARENT
@@ -13166,7 +13166,7 @@ Perl_rpeep(pTHX_ OP *o)
OpSIBLING_set(o, newop);
OpSIBLING_set(newop, ns3);
- newop->op_lastsib = 0;
+ newop->op_moresib = 1;
newop->op_flags = (newop->op_flags & ~OPf_WANT) | OPf_WANT_VOID;
diff --git a/op.h b/op.h
index 4eede91f14..5aeb9c58ad 100644
--- a/op.h
+++ b/op.h
@@ -24,7 +24,7 @@
* !op_slabbed.
* op_savefree on savestack via SAVEFREEOP
* op_folded Result/remainder of a constant fold operation.
- * op_lastsib this op is is the last sibling
+ * op_moresib this op is is not the last sibling
* op_spare One spare bit
* op_flags Flags common to all operations. See OPf_* below.
* op_private Flags peculiar to a particular operation (BUT,
@@ -39,7 +39,7 @@
typedef PERL_BITFIELD16 Optype;
/* this field now either points to the next sibling or to the parent,
- * depending on op_lastsib. So rename it from op_sibling to op_sibparent.
+ * depending on op_moresib. So rename it from op_sibling to op_sibparent.
*/
#ifdef PERL_OP_PARENT
# define _OP_SIBPARENT_FIELDNAME op_sibparent
@@ -61,7 +61,7 @@ typedef PERL_BITFIELD16 Optype;
PERL_BITFIELD16 op_savefree:1; \
PERL_BITFIELD16 op_static:1; \
PERL_BITFIELD16 op_folded:1; \
- PERL_BITFIELD16 op_lastsib:1; \
+ PERL_BITFIELD16 op_moresib:1; \
PERL_BITFIELD16 op_spare:1; \
U8 op_flags; \
U8 op_private;
@@ -981,8 +981,8 @@ Sets the sibling of o to sib
( (o) && OP_TYPE_ISNT_AND_WASNT_NN(o, type) )
#ifdef PERL_OP_PARENT
-# define OpHAS_SIBLING(o) (!cBOOL((o)->op_lastsib))
-# define OpSIBLING(o) (0 + (o)->op_lastsib ? NULL : (o)->op_sibparent)
+# define OpHAS_SIBLING(o) (cBOOL((o)->op_moresib))
+# define OpSIBLING(o) (0 + (o)->op_moresib ? (o)->op_sibparent : NULL)
# define OpSIBLING_set(o, sib) ((o)->op_sibparent = (sib))
#else
# define OpHAS_SIBLING(o) (cBOOL((o)->op_sibling))
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 4266cfa4d9..27f7540196 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -2001,7 +2001,7 @@ of the C<LOGOP>.
Starting in version 5.21.2, perls built with the experimental
define C<-DPERL_OP_PARENT> add an extra boolean flag for each op,
-C<op_lastsib>. When set, this indicates that this is the last op in an
+C<op_moresib>. When not set, this indicates that this is the last op in an
C<OpSIBLING> chain. This frees up the C<op_sibling> field on the last
sibling to point back to the parent op. Under this build, that field is
also renamed C<op_sibparent> to reflect its joint role. The macro