ApR |char * |custom_op_name |NN const OP* op
ApR |char * |custom_op_desc |NN const OP* op
-#if defined(PERL_OLD_COPY_ON_WRITE)
-pMX |int |sv_release_IVX |NN SV *sv
-#endif
-
Adp |void |sv_nosharing |NULLOK SV *sv
Adpbm |void |sv_nolocking |NULLOK SV *sv
#ifdef NO_MATHOMS
|NN const U8 *end|STRLEN endu
sn |char * |F0convert |NV nv|NN char *endbuf|NN STRLEN *len
# if defined(PERL_OLD_COPY_ON_WRITE)
-sM |void |sv_release_COW |NN SV *sv|NN const char *pvx|STRLEN len|NN SV *after
+sM |void |sv_release_COW |NN SV *sv|NN const char *pvx|NN SV *after
# endif
s |SV * |more_sv
s |void * |more_bodies |svtype sv_type
#endif
#define custom_op_name Perl_custom_op_name
#define custom_op_desc Perl_custom_op_desc
-#if defined(PERL_OLD_COPY_ON_WRITE)
-#ifdef PERL_CORE
-#define sv_release_IVX Perl_sv_release_IVX
-#endif
-#endif
#define sv_nosharing Perl_sv_nosharing
#ifdef NO_MATHOMS
#else
#endif
#define custom_op_name(a) Perl_custom_op_name(aTHX_ a)
#define custom_op_desc(a) Perl_custom_op_desc(aTHX_ a)
-#if defined(PERL_OLD_COPY_ON_WRITE)
-#ifdef PERL_CORE
-#define sv_release_IVX(a) Perl_sv_release_IVX(aTHX_ a)
-#endif
-#endif
#define sv_nosharing(a) Perl_sv_nosharing(aTHX_ a)
#ifdef NO_MATHOMS
#else
#endif
# if defined(PERL_OLD_COPY_ON_WRITE)
#ifdef PERL_CORE
-#define sv_release_COW(a,b,c,d) S_sv_release_COW(aTHX_ a,b,c,d)
+#define sv_release_COW(a,b,c) S_sv_release_COW(aTHX_ a,b,c)
#endif
# endif
#ifdef PERL_CORE
Perl_sys_intern_init
Perl_custom_op_name
Perl_custom_op_desc
-Perl_sv_release_IVX
Perl_sv_nosharing
Perl_sv_nolocking
Perl_sv_nounlocking
unless ($define{'PERL_OLD_COPY_ON_WRITE'}) {
skip_symbols [qw(
Perl_sv_setsv_cow
- Perl_sv_release_IVX
)];
}
__attribute__nonnull__(pTHX_1);
-#if defined(PERL_OLD_COPY_ON_WRITE)
-PERL_CALLCONV int Perl_sv_release_IVX(pTHX_ SV *sv)
- __attribute__nonnull__(pTHX_1);
-
-#endif
-
PERL_CALLCONV void Perl_sv_nosharing(pTHX_ SV *sv);
/* PERL_CALLCONV void Perl_sv_nolocking(pTHX_ SV *sv); */
#ifdef NO_MATHOMS
__attribute__nonnull__(3);
# if defined(PERL_OLD_COPY_ON_WRITE)
-STATIC void S_sv_release_COW(pTHX_ SV *sv, const char *pvx, STRLEN len, SV *after)
+STATIC void S_sv_release_COW(pTHX_ SV *sv, const char *pvx, SV *after)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
- __attribute__nonnull__(pTHX_4);
+ __attribute__nonnull__(pTHX_3);
# endif
STATIC SV * S_more_sv(pTHX);
(which it can do by means other than releasing copy-on-write Svs)
or by changing the other copy-on-write SVs in the loop. */
STATIC void
-S_sv_release_COW(pTHX_ register SV *sv, const char *pvx, STRLEN len, SV *after)
+S_sv_release_COW(pTHX_ register SV *sv, const char *pvx, SV *after)
{
- if (len) { /* this SV was SvIsCOW_normal(sv) */
+ { /* this SV was SvIsCOW_normal(sv) */
/* we need to find the SV pointing to us. */
SV *current = SV_COW_NEXT_SV(after);
/* Make the SV before us point to the SV after us. */
SV_COW_NEXT_SV_SET(current, after);
}
- } else {
- unshare_hek(SvSHARED_HEK_FROM_PV(pvx));
}
}
-
-int
-Perl_sv_release_IVX(pTHX_ register SV *sv)
-{
- if (SvIsCOW(sv))
- sv_force_normal_flags(sv, 0);
- SvOOK_off(sv);
- return 0;
-}
#endif
/*
=for apidoc sv_force_normal_flags
const char * const pvx = SvPVX_const(sv);
const STRLEN len = SvLEN(sv);
const STRLEN cur = SvCUR(sv);
- SV * const next = SV_COW_NEXT_SV(sv); /* next COW sv in the loop. */
+ /* next COW sv in the loop. If len is 0 then this is a shared-hash
+ key scalar, so we mustn't attempt to call SV_COW_NEXT_SV(), as
+ we'll fail an assertion. */
+ SV * const next = len ? SV_COW_NEXT_SV(sv) : 0;
+
if (DEBUG_C_TEST) {
PerlIO_printf(Perl_debug_log,
"Copy on write: Force normal %ld\n",
SvCUR_set(sv, cur);
*SvEND(sv) = '\0';
}
- sv_release_COW(sv, pvx, len, next);
+ if (len) {
+ sv_release_COW(sv, pvx, next);
+ } else {
+ unshare_hek(SvSHARED_HEK_FROM_PV(pvx));
+ }
if (DEBUG_C_TEST) {
sv_dump(sv);
}
PerlIO_printf(Perl_debug_log, "Copy on write: clear\n");
sv_dump(sv);
}
- sv_release_COW(sv, SvPVX_const(sv), SvLEN(sv),
- SV_COW_NEXT_SV(sv));
+ if (SvLEN(sv)) {
+ sv_release_COW(sv, SvPVX_const(sv), SV_COW_NEXT_SV(sv));
+ } else {
+ unshare_hek(SvSHARED_HEK_FROM_PV(SvPVX_const(sv)));
+ }
+
/* And drop it here. */
SvFAKE_off(sv);
} else if (SvLEN(sv)) {
sv_force_normal_flags(sv, SV_COW_DROP_PV)
#ifdef PERL_OLD_COPY_ON_WRITE
-# define SvRELEASE_IVX(sv) ((void)((SvFLAGS(sv) & (SVf_OOK|SVf_READONLY|SVf_FAKE)) \
- && Perl_sv_release_IVX(aTHX_ sv)))
+#define SvRELEASE_IVX(sv) \
+ ((SvIsCOW(sv) ? sv_force_normal_flags(sv, 0) : (void) 0), SvOOK_off(sv))
# define SvIsCOW_normal(sv) (SvIsCOW(sv) && SvLEN(sv))
#else
# define SvRELEASE_IVX(sv) SvOOK_off(sv)