3 <1> leavesub[2 refs] K/REFC,1 ->(end)
- <\@> lineseq KP ->3
1 <;> dbstate(main 833 (eval 44):1) v ->2
-2 <\$> const[$want->{$func}[0] $want->{$func}[1]] s* ->3
+2 <\$> const[$want->{$func}[0] $want->{$func}[1]] s*/FOLD ->3
EOT_EOT
3 <1> leavesub[2 refs] K/REFC,1 ->(end)
- <\@> lineseq KP ->3
1 <;> dbstate(main 833 (eval 44):1) v ->2
-2 <\$> const($want->{$func}[0] $want->{$func}[1]) s* ->3
+2 <\$> const($want->{$func}[0] $want->{$func}[1]) s*/FOLD ->3
EONT_EONT
}
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const[SPECIAL sv_yes] s* ->5
+# 4 <$> const[SPECIAL sv_yes] s*/FOLD ->5
EOT_EOT
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const(SPECIAL sv_yes) s* ->5
+# 4 <$> const(SPECIAL sv_yes) s*/FOLD ->5
EONT_EONT
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const[SPECIAL sv_no] s* ->5
+# 4 <$> const[SPECIAL sv_no] s*/FOLD ->5
EOT_EOT
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const(SPECIAL sv_no) s* ->5
+# 4 <$> const(SPECIAL sv_no) s*/FOLD ->5
EONT_EONT
# 1 <;> nextstate(main 635 optree_constants.t:163) v:>,<,% ->2
# 8 <@> prtf sK ->9
# 2 <0> pushmark sM ->3
-# 3 <$> const[PV "myint %d mystr %s myfl %f pi %f\n"] sM ->4
-# 4 <$> const[IV 42] sM* ->5
-# 5 <$> const[PV "hithere"] sM* ->6
-# 6 <$> const[NV 1.414213] sM* ->7
-# 7 <$> const[NV 3.14159] sM* ->8
+# 3 <$> const[PV "myint %d mystr %s myfl %f pi %f\n"] sM/FOLD ->4
+# 4 <$> const[IV 42] sM*/FOLD ->5
+# 5 <$> const[PV "hithere"] sM*/FOLD ->6
+# 6 <$> const[NV 1.414213] sM*/FOLD ->7
+# 7 <$> const[NV 3.14159] sM*/FOLD ->8
EOT_EOT
# 9 <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->9
# 1 <;> nextstate(main 635 optree_constants.t:163) v:>,<,% ->2
# 8 <@> prtf sK ->9
# 2 <0> pushmark sM ->3
-# 3 <$> const(PV "myint %d mystr %s myfl %f pi %f\n") sM ->4
-# 4 <$> const(IV 42) sM* ->5
-# 5 <$> const(PV "hithere") sM* ->6
-# 6 <$> const(NV 1.414213) sM* ->7
-# 7 <$> const(NV 3.14159) sM* ->8
+# 3 <$> const(PV "myint %d mystr %s myfl %f pi %f\n") sM/FOLD ->4
+# 4 <$> const(IV 42) sM*/FOLD ->5
+# 5 <$> const(PV "hithere") sM*/FOLD ->6
+# 6 <$> const(NV 1.414213) sM*/FOLD ->7
+# 7 <$> const(NV 3.14159) sM*/FOLD ->8
EONT_EONT
if($] < 5.015) {
# 1 <;> nextstate(main 937 (eval 53):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const[IV 6] s ->4
+# 3 <$> const[IV 6] s/FOLD ->4
EOT_EOT
# 5 <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->5
# 1 <;> nextstate(main 937 (eval 53):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const(IV 6) s ->4
+# 3 <$> const(IV 6) s/FOLD ->4
EONT_EONT
checkOptree ( name => 'string constant folding in print',
# 1 <;> nextstate(main 942 (eval 55):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const[PV "foobar"] s ->4
+# 3 <$> const[PV "foobar"] s/FOLD ->4
EOT_EOT
# 5 <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->5
# 1 <;> nextstate(main 942 (eval 55):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const(PV "foobar") s ->4
+# 3 <$> const(PV "foobar") s/FOLD ->4
EONT_EONT
checkOptree ( name => 'boolean or folding',
# - <@> lineseq KP ->r
# 1 <;> nextstate(main 916 optree_constants.t:307) v:>,<,%,{ ->2
# 4 <2> sassign vKS/2 ->5
-# 2 <$> const[PV "FOO.Bar.low.lOW"] s ->3
+# 2 <$> const[PV "FOO.Bar.low.lOW"] s/FOLD ->3
# - <1> ex-rv2sv sKRM*/1 ->4
# 3 <#> gvsv[*s] s ->4
# 5 <;> nextstate(main 916 optree_constants.t:308) v:>,<,%,{ ->6
# m <0> pushmark s ->n
# n <$> const[PV "b-cmp-a"] s ->o
# p <;> nextstate(main 916 optree_constants.t:313) v:>,<,%,{ ->q
-# q <$> const[PVNV 0] s/SHORT ->r
+# q <$> const[PVNV 0] s/FOLD,SHORT ->r
EOT_EOT
# r <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->r
# 1 <;> nextstate(main 916 optree_constants.t:307) v:>,<,%,{ ->2
# 4 <2> sassign vKS/2 ->5
-# 2 <$> const(PV "FOO.Bar.low.lOW") s ->3
+# 2 <$> const(PV "FOO.Bar.low.lOW") s/FOLD ->3
# - <1> ex-rv2sv sKRM*/1 ->4
# 3 <$> gvsv(*s) s ->4
# 5 <;> nextstate(main 916 optree_constants.t:308) v:>,<,%,{ ->6
# m <0> pushmark s ->n
# n <$> const(PV "b-cmp-a") s ->o
# p <;> nextstate(main 916 optree_constants.t:313) v:>,<,%,{ ->q
-# q <$> const(SPECIAL sv_no) s/SHORT ->r
+# q <$> const(SPECIAL sv_no) s/FOLD,SHORT ->r
EONT_EONT
checkOptree ( name => 'mixed constant folding, with explicit braces',
# 1 <;> nextstate(main 977 (eval 28):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const[PV "foobar5"] s ->4
+# 3 <$> const[PV "foobar5"] s/FOLD ->4
EOT_EOT
# 5 <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->5
# 1 <;> nextstate(main 977 (eval 28):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const(PV "foobar5") s ->4
+# 3 <$> const(PV "foobar5") s/FOLD ->4
EONT_EONT
__END__
if (type == OP_RV2GV)
newop = newGVOP(OP_GV, 0, MUTABLE_GV(sv));
else
- newop = newSVOP(OP_CONST, 0, MUTABLE_SV(sv));
+ newop = newSVOP(OP_CONST, OPpCONST_FOLDED<<8, MUTABLE_SV(sv));
op_getmad(o,newop,'f');
return newop;
svop->op_sv = sv;
svop->op_next = (OP*)svop;
svop->op_flags = (U8)flags;
+ svop->op_private = (U8)(0 | (flags >> 8));
if (PL_opargs[type] & OA_RETSCALAR)
scalar((OP*)svop);
if (PL_opargs[type] & OA_TARGET)
|| 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;
return other;
}
else {
|| 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;
return live;
}
NewOp(1101, logop, 1, LOGOP);