Disable by default the new Copy-on-Write for 5.18
authorDavid Mitchell <davem@iabyn.com>
Sat, 2 Mar 2013 23:31:13 +0000 (23:31 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 2 Mar 2013 23:40:08 +0000 (23:40 +0000)
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
pod/perldelta.pod
t/re/pat_rt_report.t

diff --git a/perl.h b/perl.h
index 0613d6e..4b020c7 100644 (file)
--- 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"
index 8be911f..8387c30 100644 (file)
@@ -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<Configure> 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
 
index e6ee0dd..2244fdf 100644 (file)
@@ -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');