diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-06 06:25:59 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-11 07:41:25 -0700 |
commit | 1620522e445f07dfded3e2bd7051de7349c2ee3e (patch) | |
tree | 337b664208a1703e2e12d9507085a17e86332019 /universal.c | |
parent | 56e04a766185949119c93e963353f9a8712b8ec1 (diff) | |
download | perl-1620522e445f07dfded3e2bd7051de7349c2ee3e.tar.gz |
universal.c: Ignore SvIsCOW in XS_Internals_SvREADONLY
SvIsCOW used to check SVf_READONLY|SVf_FAKE. e3918bb703ca changed
that, but did not change the assumptions that code already made (that
there could be not truly read-only COWs.
Now SvREADONLY actually means read-only, so Internals::SvREADONLY
should not be saying that read-ony COWs are not, nor does it need to
flatten COWs when making them read-only. Hence, locking hash values
no longer has a speed and memory hit if that hash contains COWs.
Part of the code is left in place for PERL_OLD_COPY_ON_WRITE, to avoid
making read-only COWs under that configuration. See the previous com-
mit for why.
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/universal.c b/universal.c index 46511d30c9..10fefe1e61 100644 --- a/universal.c +++ b/universal.c @@ -912,14 +912,16 @@ XS(XS_Internals_SvREADONLY) /* This is dangerous stuff. */ sv = SvRV(svz); if (items == 1) { - if (SvREADONLY(sv) && !SvIsCOW(sv)) + if (SvREADONLY(sv)) XSRETURN_YES; else XSRETURN_NO; } else if (items == 2) { if (SvTRUE(ST(1))) { +#ifdef PERL_OLD_COPY_ON_WRITE if (SvIsCOW(sv)) sv_force_normal(sv); +#endif SvREADONLY_on(sv); if (SvTYPE(sv) == SVt_PVAV && AvFILLp(sv) != -1) { /* for constant.pm; nobody else should be calling this @@ -934,7 +936,7 @@ XS(XS_Internals_SvREADONLY) /* This is dangerous stuff. */ } else { /* I hope you really know what you are doing. */ - if (!SvIsCOW(sv)) SvREADONLY_off(sv); + SvREADONLY_off(sv); XSRETURN_NO; } } |