summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-12-04 14:52:45 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-12-05 21:31:42 -0800
commitbcea25a760263ce058f5588c6ae62af6f09a211e (patch)
treeaa53a93f8e38eb6c1083e3e5e46de49b1752b8c0
parent19b29141f68d34f2b832ff2cddd54122e3ed3c28 (diff)
downloadperl-bcea25a760263ce058f5588c6ae62af6f09a211e.tar.gz
Don’t use PMf_ONCE flag for split-to-array
Currently the PMf_ONCE flag has two purposes. It is used to indicate that m?? must match only once. That’s what distinguishes m?? and m// internally. The other use indicates that @x = split... modifies the array in place. Whenever the split op is modified to point straight to the array, the PMf_ONCE flag is set. pp_split checks both whether there is an array attached to the op (via a GV in the pad under threads, or a pointer from the op to the GV under non-threaded builds) and whether the flag is set. This makes the flag redundant in the split case. Removing its use here not only simplifies the code and removes redun- dant bit-fiddling, but also makes this comment in toke.c, added by ad639bfb6, come true: /* This is the only point in the code that sets PMf_ONCE: */ (That was actually harmless, as it doesn’t hurt to have a stash refer- ring to pmops that don’t use the PMf_USED flag, and the PMf_ONCE flag is set for split way after that code is run. It is also unnecessary for split, as that bookkeeping code in toke.c only applies to the m?? use of PMf_ONCE.) This commit also removes a gimme != G_ARRAY check that thas been redundant since a6d8037e26a.
-rw-r--r--op.c1
-rw-r--r--pp.c2
2 files changed, 1 insertions, 2 deletions
diff --git a/op.c b/op.c
index b0a30731fb..15930b62a7 100644
--- a/op.c
+++ b/op.c
@@ -5596,7 +5596,6 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
= MUTABLE_GV(cSVOPx(tmpop)->op_sv);
cSVOPx(tmpop)->op_sv = NULL; /* steal it */
#endif
- pm->op_pmflags |= PMf_ONCE;
tmpop = cUNOPo->op_first; /* to list (nulled) */
tmpop = ((UNOP*)tmpop)->op_first; /* to pushmark */
tmpop->op_sibling = NULL; /* don't free split */
diff --git a/pp.c b/pp.c
index e1c9d7580a..cf59a84e21 100644
--- a/pp.c
+++ b/pp.c
@@ -5353,7 +5353,7 @@ PP(pp_split)
#endif
else
ary = NULL;
- if (ary && (gimme != G_ARRAY || (pm->op_pmflags & PMf_ONCE))) {
+ if (ary) {
realarray = 1;
PUTBACK;
av_extend(ary,0);