This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove OPpCONST_FOLDED
authorFather Chrysostomos <sprout@cpan.org>
Sun, 15 Sep 2013 22:37:43 +0000 (15:37 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 16 Sep 2013 15:22:51 +0000 (08:22 -0700)
Now that we have op->op_folded, we don’t need OPpCONST_FOLDED any
more.  In removing it, I modified B::Concise to output op_folded the
way OPpCONST_FOLDED was output before, since it can be helpful to have
it when reading op dumps.

dump.c
ext/B/B/Concise.pm
op.c
op.h
toke.c

diff --git a/dump.c b/dump.c
index 1aa96ce..0202522 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -744,7 +744,6 @@ const struct flag_to_name op_const_names[] = {
     {OPpCONST_SHORTCIRCUIT, ",SHORTCIRCUIT"},
     {OPpCONST_STRICT, ",STRICT"},
     {OPpCONST_ENTERED, ",ENTERED"},
-    {OPpCONST_FOLDED, ",FOLDED"},
     {OPpCONST_BARE, ",BARE"}
 };
 
index c644d30..dedae5a 100644 (file)
@@ -633,7 +633,7 @@ $priv{$_}{16} = "TARGMY"
          link symlink mkdir rmdir wait waitpid system exec kill getppid
          getpgrp setpgrp getpriority setpriority time sleep);
 $priv{$_}{4} = "REVERSED" for qw(enteriter iter);
-@{$priv{const}}{2,4,8,16,64,128} = qw(NOVER SHORT STRICT ENTERED BARE FOLD);
+@{$priv{const}}{2,4,8,16,64} = qw(NOVER SHORT STRICT ENTERED BARE);
 $priv{$_}{64} = "LINENUM" for qw(flip flop);
 $priv{list}{64} = "GUESSED";
 $priv{delete}{64} = "SLICE";
@@ -916,6 +916,10 @@ sub concise_op {
     $h{flags} = op_flags($op->flags);
     $h{privval} = $op->private;
     $h{private} = private_flags($h{name}, $op->private);
+    if ($op->folded) {
+      $h{private} &&= "$h{private},";
+      $h{private} .= "FOLD";
+    }
     if ($op->can("hints")) {
       $h{hintsval} = $op->hints;
       $h{hints} = hints_flags($h{hintsval});
diff --git a/op.c b/op.c
index 3ea0195..87e3403 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3439,7 +3439,7 @@ S_fold_constants(pTHX_ OP *o)
        newop = newGVOP(OP_GV, 0, MUTABLE_GV(sv));
     else
     {
-       newop = newSVOP(OP_CONST, OPpCONST_FOLDED<<8, MUTABLE_SV(sv));
+       newop = newSVOP(OP_CONST, 0, MUTABLE_SV(sv));
        newop->op_folded = 1;
     }
     op_getmad(o,newop,'f');
@@ -6015,8 +6015,6 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
                  || other->op_type == OP_TRANS)
                /* Mark the op as being unbindable with =~ */
                other->op_flags |= OPf_SPECIAL;
-           else if (other->op_type == OP_CONST)
-               other->op_private |= OPpCONST_FOLDED;
 
            other->op_folded = 1;
            return other;
@@ -6178,8 +6176,6 @@ Perl_newCONDOP(pTHX_ I32 flags, OP *first, OP *trueop, OP *falseop)
              || live->op_type == OP_TRANS || live->op_type == OP_TRANSR)
            /* Mark the op as being unbindable with =~ */
            live->op_flags |= OPf_SPECIAL;
-       else if (live->op_type == OP_CONST)
-           live->op_private |= OPpCONST_FOLDED;
        live->op_folded = 1;
        return live;
     }
diff --git a/op.h b/op.h
index 7366444..5d29199 100644 (file)
--- a/op.h
+++ b/op.h
@@ -288,8 +288,6 @@ is no conversion of op type.
 #define        OPpCONST_STRICT         8       /* bareword subject to strict 'subs' */
 #define OPpCONST_ENTERED       16      /* Has been entered as symbol. */
 #define OPpCONST_BARE          64      /* Was a bare word (filehandle?). */
-/* Replaced by op_folded in perl itself, still used by B/B::Concise etc. */
-#define OPpCONST_FOLDED                128     /* Result of constant folding */
 
 /* Private for OP_FLIP/FLOP */
 #define OPpFLIP_LINENUM                64      /* Range arg potentially a line num. */
diff --git a/toke.c b/toke.c
index 8cca3f4..5a65548 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -7412,7 +7412,7 @@ Perl_yylex(pTHX)
                            pl_yylval.opval = newUNOP(OP_RV2AV, OPf_PARENS,
                                                      pl_yylval.opval);
                        else {
-                           pl_yylval.opval->op_private = OPpCONST_FOLDED;
+                           pl_yylval.opval->op_private = 0;
                            pl_yylval.opval->op_folded = 1;
                            pl_yylval.opval->op_flags |= OPf_SPECIAL;
                        }