summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-11-13 05:52:00 -0800
committerFather Chrysostomos <sprout@cpan.org>2013-11-30 05:53:16 -0800
commit0fd5eacbba20c136307374df51bc994313db0157 (patch)
tree657c5a1d3bfddae633afffc4542bfcb1b9a3dd1f
parentd0916088db95dc07ca4cf83f9bf49d23c721281f (diff)
downloadperl-0fd5eacbba20c136307374df51bc994313db0157.tar.gz
op.c: Turn on read-only flag for folded constants
They are marked PADTMP, which causes them to be copied in any contexts where readonliness makes a difference, so marking them as read-only does not change the behaviour. What it does is allow a future commit to implement string swiping for PADTMPs.
-rw-r--r--op.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/op.c b/op.c
index c2029a30bb..29eb74585d 100644
--- a/op.c
+++ b/op.c
@@ -3563,7 +3563,10 @@ S_fold_constants(pTHX_ OP *o)
#endif
assert(sv);
if (type == OP_STRINGIFY) SvPADTMP_off(sv);
- else if (!SvIMMORTAL(sv)) SvPADTMP_on(sv);
+ else if (!SvIMMORTAL(sv)) {
+ SvPADTMP_on(sv);
+ SvREADONLY_on(sv);
+ }
if (type == OP_RV2GV)
newop = newGVOP(OP_GV, 0, MUTABLE_GV(sv));
else
@@ -3612,7 +3615,10 @@ S_gen_constant_list(pTHX_ OP *o)
((UNOP*)o)->op_first = newSVOP(OP_CONST, 0, (SV *)av);
if (AvFILLp(av) != -1)
for (svp = AvARRAY(av) + AvFILLp(av); svp >= AvARRAY(av); --svp)
+ {
SvPADTMP_on(*svp);
+ SvREADONLY_on(*svp);
+ }
#ifdef PERL_MAD
op_getmad(curop,o,'O');
#else