Skip to content

Commit

Permalink
Remove NEW_ from PERL_NEW_COPY_ON_WRITE
Browse files Browse the repository at this point in the history
  • Loading branch information
Father Chrysostomos committed Jun 29, 2015
1 parent b326ddf commit 93c10d6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dump.c
Expand Up @@ -1620,7 +1620,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
if (!re)
Perl_dump_indent(aTHX_ level, file, " LEN = %"IVdf"\n",
(IV)SvLEN(sv));
#ifdef PERL_NEW_COPY_ON_WRITE
#ifdef PERL_COPY_ON_WRITE
if (SvIsCOW(sv) && SvLEN(sv))
Perl_dump_indent(aTHX_ level, file, " COW_REFCNT = %d\n",
CowREFCNT(sv));
Expand Down
2 changes: 1 addition & 1 deletion makedef.pl
Expand Up @@ -285,7 +285,7 @@ sub readvar {
);
}

unless ($define{'PERL_NEW_COPY_ON_WRITE'}) {
unless ($define{'PERL_COPY_ON_WRITE'}) {
++$skip{Perl_sv_setsv_cow};
}

Expand Down
2 changes: 1 addition & 1 deletion op.c
Expand Up @@ -11949,7 +11949,7 @@ Perl_ck_svconst(pTHX_ OP *o)
SV * const sv = cSVOPo->op_sv;
PERL_ARGS_ASSERT_CK_SVCONST;
PERL_UNUSED_CONTEXT;
#ifdef PERL_NEW_COPY_ON_WRITE
#ifdef PERL_COPY_ON_WRITE
/* Since the read-only flag may be used to protect a string buffer, we
cannot do copy-on-write with existing read-only scalars that are not
already copy-on-write scalars. To allow $_ = "hello" to do COW with
Expand Down
6 changes: 3 additions & 3 deletions perl.c
Expand Up @@ -1692,6 +1692,9 @@ S_Internals_V(pTHX_ CV *cv)
# ifdef PERL_BOOL_AS_CHAR
" PERL_BOOL_AS_CHAR"
# endif
# ifdef PERL_COPY_ON_WRITE
" PERL_COPY_ON_WRITE"
# endif
# ifdef PERL_DISABLE_PMC
" PERL_DISABLE_PMC"
# endif
Expand Down Expand Up @@ -1737,9 +1740,6 @@ S_Internals_V(pTHX_ CV *cv)
# ifdef PERL_MEM_LOG_NOIMPL
" PERL_MEM_LOG_NOIMPL"
# endif
# ifdef PERL_NEW_COPY_ON_WRITE
" PERL_NEW_COPY_ON_WRITE"
# endif
# ifdef PERL_PERTURB_KEYS_DETERMINISTIC
" PERL_PERTURB_KEYS_DETERMINISTIC"
# endif
Expand Down
8 changes: 4 additions & 4 deletions perl.h
Expand Up @@ -2643,12 +2643,12 @@ typedef AV PAD;
typedef struct padnamelist PADNAMELIST;
typedef struct padname PADNAME;

/* enable PERL_NEW_COPY_ON_WRITE by default */
#if !defined(PERL_NEW_COPY_ON_WRITE) && !defined(PERL_NO_COW)
# define PERL_NEW_COPY_ON_WRITE
/* enable PERL_COPY_ON_WRITE by default */
#if !defined(PERL_COPY_ON_WRITE) && !defined(PERL_NO_COW)
# define PERL_COPY_ON_WRITE
#endif

#ifdef PERL_NEW_COPY_ON_WRITE
#ifdef PERL_COPY_ON_WRITE
# define PERL_ANY_COW
#else
# define PERL_SAWAMPERSAND
Expand Down
10 changes: 5 additions & 5 deletions sv.c
Expand Up @@ -1583,7 +1583,7 @@ Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen)
s = SvPVX_mutable(sv);
}

#ifdef PERL_NEW_COPY_ON_WRITE
#ifdef PERL_COPY_ON_WRITE
/* the new COW scheme uses SvPVX(sv)[SvLEN(sv)-1] (if spare)
* to store the COW count. So in general, allocate one more byte than
* asked for, to make it likely this byte is always spare: and thus
Expand Down Expand Up @@ -4621,7 +4621,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* sstr, const I32 flags)
}
else if (flags & SV_COW_SHARED_HASH_KEYS
&&
#ifdef PERL_NEW_COPY_ON_WRITE
#ifdef PERL_COPY_ON_WRITE
(sflags & SVf_IsCOW
? (!len ||
( (CHECK_COWBUF_THRESHOLD(cur,len) || SvLEN(dstr) < cur+1)
Expand Down Expand Up @@ -4752,7 +4752,7 @@ Perl_sv_setsv_cow(pTHX_ SV *dstr, SV *sstr)
STRLEN cur = SvCUR(sstr);
STRLEN len = SvLEN(sstr);
char *new_pv;
#if defined(PERL_DEBUG_READONLY_COW) && defined(PERL_NEW_COPY_ON_WRITE)
#if defined(PERL_DEBUG_READONLY_COW) && defined(PERL_COPY_ON_WRITE)
const bool already = cBOOL(SvIsCOW(sstr));
#endif

Expand Down Expand Up @@ -5097,7 +5097,7 @@ S_sv_uncow(pTHX_ SV * const sv, const U32 flags)
sv_dump(sv);
}
SvIsCOW_off(sv);
# ifdef PERL_NEW_COPY_ON_WRITE
# ifdef PERL_COPY_ON_WRITE
if (len) {
/* Must do this first, since the CowREFCNT uses SvPVX and
we need to write to CowREFCNT, or de-RO the whole buffer if we are
Expand Down Expand Up @@ -8158,7 +8158,7 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 append)
if (fd >= 0 && (PerlLIO_fstat(fd, &st) == 0) && S_ISREG(st.st_mode)) {
const Off_t offset = PerlIO_tell(fp);
if (offset != (Off_t) -1 && st.st_size + append > offset) {
#ifdef PERL_NEW_COPY_ON_WRITE
#ifdef PERL_COPY_ON_WRITE
/* Add an extra byte for the sake of copy-on-write's
* buffer reference count. */
(void) SvGROW(sv, (STRLEN)((st.st_size - offset) + append + 2));
Expand Down
2 changes: 1 addition & 1 deletion sv.h
Expand Up @@ -1864,7 +1864,7 @@ Like sv_utf8_upgrade, but doesn't do magic on C<sv>.
#define SV_CHECK_THINKFIRST_COW_DROP(sv) if (SvTHINKFIRST(sv)) \
sv_force_normal_flags(sv, SV_COW_DROP_PV)

#ifdef PERL_NEW_COPY_ON_WRITE
#ifdef PERL_COPY_ON_WRITE
# define SvCANCOW(sv) \
(SvIsCOW(sv) \
? SvLEN(sv) ? CowREFCNT(sv) != SV_COW_REFCNT_MAX : 1 \
Expand Down

0 comments on commit 93c10d6

Please sign in to comment.