From 9f351b45f43b0ed78a9b796af692ef90a6d23879 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Sat, 2 Mar 2013 23:31:13 +0000 Subject: [PATCH] Disable by default the new Copy-on-Write for 5.18 It was felt that the new COW feature wasn't ready to be enabled be default in 5.18: principally because too much XS code will assume it can just manipulate the PVX buffer of an SVf_POK SV. See RT #116569 for the discussion. --- perl.h | 10 +++++++--- pod/perldelta.pod | 14 +++++++++++++- t/re/pat_rt_report.t | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/perl.h b/perl.h index 0613d6e..4b020c7 100644 --- a/perl.h +++ b/perl.h @@ -2494,9 +2494,11 @@ typedef AV PAD; typedef AV PADNAMELIST; typedef SV PADNAME; -#if !defined(PERL_OLD_COPY_ON_WRITE) && !defined(PERL_NEW_COPY_ON_WRITE) && !defined(PERL_NO_COW) -# define PERL_NEW_COPY_ON_WRITE -#endif +/* XXX for 5.18, disable the COW by default + * #if !defined(PERL_OLD_COPY_ON_WRITE) && !defined(PERL_NEW_COPY_ON_WRITE) && !defined(PERL_NO_COW) + * # define PERL_NEW_COPY_ON_WRITE + * #endif + */ #if defined(PERL_OLD_COPY_ON_WRITE) || defined(PERL_NEW_COPY_ON_WRITE) # if defined(PERL_OLD_COPY_ON_WRITE) && defined(PERL_NEW_COPY_ON_WRITE) @@ -2504,6 +2506,8 @@ typedef SV PADNAME; # else # define PERL_ANY_COW # endif +#else +# define PERL_SAWAMPERSAND #endif #include "handy.h" diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 8be911f..8387c30 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -304,7 +304,19 @@ well. =item * -XXX +The new copy-on-write mechanism that was introduced in 5.17.7 has now been +disabled by default, since it was felt that there were two many rough +edges for the 5.18 release. It is expected that it will be enabled by +default for 5.20. + +This change also re-enables PL_sawampersand by default. + +It can be enabled in a perl build by running F with +B<-Accflags=-DPERL_NEW_COPY_ON_WRITE>, and we would encourage XS authors to +try their code with such an enabled perl, and provide feedback. +XXX need blurb, e.g. a reference to a new section in perlguts or perlxs +explaining how XS authors should handle COW strings. + =back diff --git a/t/re/pat_rt_report.t b/t/re/pat_rt_report.t index e6ee0dd..2244fdf 100644 --- a/t/re/pat_rt_report.t +++ b/t/re/pat_rt_report.t @@ -1147,6 +1147,7 @@ EOP { # [perl #4289] First mention $& after a match + local $::TODO = "these tests fail without Copy-on-Write enabled"; fresh_perl_is( '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$&|, "\n"', "b\n", {}, '$& first mentioned after match'); -- 2.7.4