Skip to content

Commit 9f351b4

Browse files
committed
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.
1 parent 126fc07 commit 9f351b4

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

perl.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,16 +2494,20 @@ typedef AV PAD;
24942494
typedef AV PADNAMELIST;
24952495
typedef SV PADNAME;
24962496

2497-
#if !defined(PERL_OLD_COPY_ON_WRITE) && !defined(PERL_NEW_COPY_ON_WRITE) && !defined(PERL_NO_COW)
2498-
# define PERL_NEW_COPY_ON_WRITE
2499-
#endif
2497+
/* XXX for 5.18, disable the COW by default
2498+
* #if !defined(PERL_OLD_COPY_ON_WRITE) && !defined(PERL_NEW_COPY_ON_WRITE) && !defined(PERL_NO_COW)
2499+
* # define PERL_NEW_COPY_ON_WRITE
2500+
* #endif
2501+
*/
25002502

25012503
#if defined(PERL_OLD_COPY_ON_WRITE) || defined(PERL_NEW_COPY_ON_WRITE)
25022504
# if defined(PERL_OLD_COPY_ON_WRITE) && defined(PERL_NEW_COPY_ON_WRITE)
25032505
# error PERL_OLD_COPY_ON_WRITE and PERL_NEW_COPY_ON_WRITE are exclusive
25042506
# else
25052507
# define PERL_ANY_COW
25062508
# endif
2509+
#else
2510+
# define PERL_SAWAMPERSAND
25072511
#endif
25082512

25092513
#include "handy.h"

pod/perldelta.pod

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,19 @@ well.
304304

305305
=item *
306306

307-
XXX
307+
The new copy-on-write mechanism that was introduced in 5.17.7 has now been
308+
disabled by default, since it was felt that there were two many rough
309+
edges for the 5.18 release. It is expected that it will be enabled by
310+
default for 5.20.
311+
312+
This change also re-enables PL_sawampersand by default.
313+
314+
It can be enabled in a perl build by running F<Configure> with
315+
B<-Accflags=-DPERL_NEW_COPY_ON_WRITE>, and we would encourage XS authors to
316+
try their code with such an enabled perl, and provide feedback.
317+
XXX need blurb, e.g. a reference to a new section in perlguts or perlxs
318+
explaining how XS authors should handle COW strings.
319+
308320

309321
=back
310322

t/re/pat_rt_report.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,7 @@ EOP
11471147

11481148
{
11491149
# [perl #4289] First mention $& after a match
1150+
local $::TODO = "these tests fail without Copy-on-Write enabled";
11501151
fresh_perl_is(
11511152
'$_ = "abc"; /b/g; $_ = "hello"; print eval q|$&|, "\n"',
11521153
"b\n", {}, '$& first mentioned after match');

0 commit comments

Comments
 (0)