This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
embed.fnc: Formal param shouldn't be const
[perl5.git] / proto.h
diff --git a/proto.h b/proto.h
index 8f64cf6..1211e57 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -35,15 +35,29 @@ PERL_CALLCONV UV    NATIVE_TO_NEED(const UV enc, const UV ch)
 #endif
 
 PERL_CALLCONV const char *     Perl_PerlIO_context_layers(pTHX_ const char *mode);
+PERL_CALLCONV int      Perl_PerlLIO_dup2_cloexec(pTHX_ int oldfd, int newfd);
+PERL_CALLCONV int      Perl_PerlLIO_dup_cloexec(pTHX_ int oldfd)
+                       __attribute__warn_unused_result__;
+
+PERL_CALLCONV int      Perl_PerlLIO_open3_cloexec(pTHX_ const char *file, int flag, int perm)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_PERLLIO_OPEN3_CLOEXEC \
+       assert(file)
+
+PERL_CALLCONV int      Perl_PerlLIO_open_cloexec(pTHX_ const char *file, int flag)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_PERLLIO_OPEN_CLOEXEC  \
+       assert(file)
+
 PERL_CALLCONV void*    Perl_Slab_Alloc(pTHX_ size_t sz)
                        __attribute__warn_unused_result__;
 
 PERL_CALLCONV void     Perl_Slab_Free(pTHX_ void *op);
 #define PERL_ARGS_ASSERT_SLAB_FREE     \
        assert(op)
-PERL_CALLCONV char *   Perl__byte_dump_string(pTHX_ const U8 * s, const STRLEN len, const bool format);
+PERL_CALLCONV char *   Perl__byte_dump_string(pTHX_ const U8 * const start, const STRLEN len, const bool format);
 #define PERL_ARGS_ASSERT__BYTE_DUMP_STRING     \
-       assert(s)
+       assert(start)
 PERL_CALLCONV void     Perl__force_out_malformed_utf8_message(pTHX_ const U8 *const p, const U8 * const e, const U32 flags, const bool die_here);
 #define PERL_ARGS_ASSERT__FORCE_OUT_MALFORMED_UTF8_MESSAGE     \
        assert(p); assert(e)
@@ -256,12 +270,15 @@ PERL_CALLCONV void        Perl_boot_core_mro(pTHX);
 PERL_CALLCONV int      Perl_bytes_cmp_utf8(pTHX_ const U8 *b, STRLEN blen, const U8 *u, STRLEN ulen);
 #define PERL_ARGS_ASSERT_BYTES_CMP_UTF8        \
        assert(b); assert(u)
-PERL_CALLCONV U8*      Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *len, bool *is_utf8);
+PERL_CALLCONV U8*      Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *lenp, bool *is_utf8p);
 #define PERL_ARGS_ASSERT_BYTES_FROM_UTF8       \
-       assert(s); assert(len)
-PERL_CALLCONV U8*      Perl_bytes_to_utf8(pTHX_ const U8 *s, STRLEN *len);
+       assert(s); assert(lenp); assert(is_utf8p)
+PERL_CALLCONV U8*      Perl_bytes_from_utf8_loc(const U8 *s, STRLEN *lenp, bool *is_utf8p, const U8 ** first_unconverted);
+#define PERL_ARGS_ASSERT_BYTES_FROM_UTF8_LOC   \
+       assert(s); assert(lenp); assert(is_utf8p)
+PERL_CALLCONV U8*      Perl_bytes_to_utf8(pTHX_ const U8 *s, STRLEN *lenp);
 #define PERL_ARGS_ASSERT_BYTES_TO_UTF8 \
-       assert(s); assert(len)
+       assert(s); assert(lenp)
 PERL_CALLCONV I32      Perl_call_argv(pTHX_ const char* sub_name, I32 flags, char** argv);
 #define PERL_ARGS_ASSERT_CALL_ARGV     \
        assert(sub_name); assert(argv)
@@ -275,7 +292,7 @@ PERL_CALLCONV I32   Perl_call_method(pTHX_ const char* methname, I32 flags);
 PERL_CALLCONV I32      Perl_call_pv(pTHX_ const char* sub_name, I32 flags);
 #define PERL_ARGS_ASSERT_CALL_PV       \
        assert(sub_name)
-PERL_CALLCONV I32      Perl_call_sv(pTHX_ SV* sv, VOL I32 flags);
+PERL_CALLCONV I32      Perl_call_sv(pTHX_ SV* sv, volatile I32 flags);
 #define PERL_ARGS_ASSERT_CALL_SV       \
        assert(sv)
 PERL_CALLCONV const PERL_CONTEXT *     Perl_caller_cx(pTHX_ I32 level, const PERL_CONTEXT **dbcxp);
@@ -651,13 +668,16 @@ PERL_CALLCONV void        Perl_cv_forget_slab(pTHX_ CV *cv);
 PERL_CALLCONV void     Perl_cv_get_call_checker(pTHX_ CV *cv, Perl_call_checker *ckfun_p, SV **ckobj_p);
 #define PERL_ARGS_ASSERT_CV_GET_CALL_CHECKER   \
        assert(cv); assert(ckfun_p); assert(ckobj_p)
+PERL_CALLCONV void     Perl_cv_get_call_checker_flags(pTHX_ CV *cv, U32 gflags, Perl_call_checker *ckfun_p, SV **ckobj_p, U32 *ckflags_p);
+#define PERL_ARGS_ASSERT_CV_GET_CALL_CHECKER_FLAGS     \
+       assert(cv); assert(ckfun_p); assert(ckobj_p); assert(ckflags_p)
 PERL_CALLCONV SV *     Perl_cv_name(pTHX_ CV *cv, SV *sv, U32 flags);
 #define PERL_ARGS_ASSERT_CV_NAME       \
        assert(cv)
 PERL_CALLCONV void     Perl_cv_set_call_checker(pTHX_ CV *cv, Perl_call_checker ckfun, SV *ckobj);
 #define PERL_ARGS_ASSERT_CV_SET_CALL_CHECKER   \
        assert(cv); assert(ckfun); assert(ckobj)
-PERL_CALLCONV void     Perl_cv_set_call_checker_flags(pTHX_ CV *cv, Perl_call_checker ckfun, SV *ckobj, U32 flags);
+PERL_CALLCONV void     Perl_cv_set_call_checker_flags(pTHX_ CV *cv, Perl_call_checker ckfun, SV *ckobj, U32 ckflags);
 #define PERL_ARGS_ASSERT_CV_SET_CALL_CHECKER_FLAGS     \
        assert(cv); assert(ckfun); assert(ckobj)
 PERL_CALLCONV void     Perl_cv_undef(pTHX_ CV* cv);
@@ -738,7 +758,6 @@ PERL_CALLCONV void  Perl_do_dump_pad(pTHX_ I32 level, PerlIO *file, PADLIST *padl
 PERL_CALLCONV bool     Perl_do_eof(pTHX_ GV* gv);
 #define PERL_ARGS_ASSERT_DO_EOF        \
        assert(gv)
-PERL_CALLCONV void     Perl_do_execfree(pTHX);
 PERL_CALLCONV void     Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv);
 #define PERL_ARGS_ASSERT_DO_GV_DUMP    \
        assert(file); assert(name)
@@ -773,7 +792,7 @@ PERL_CALLCONV bool  Perl_do_open6(pTHX_ GV *gv, const char *oname, STRLEN len, Pe
 PERL_CALLCONV bool     Perl_do_open9(pTHX_ GV *gv, const char *name, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp, SV *svs, I32 num);
 #define PERL_ARGS_ASSERT_DO_OPEN9      \
        assert(gv); assert(name); assert(svs)
-PERL_CALLCONV bool     Perl_do_open_raw(pTHX_ GV *gv, const char *oname, STRLEN len, int rawmode, int rawperm);
+PERL_CALLCONV bool     Perl_do_open_raw(pTHX_ GV *gv, const char *oname, STRLEN len, int rawmode, int rawperm, Stat_t *statbufp);
 #define PERL_ARGS_ASSERT_DO_OPEN_RAW   \
        assert(gv); assert(oname)
 PERL_CALLCONV bool     Perl_do_openn(pTHX_ GV *gv, const char *oname, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp, SV **svp, I32 num);
@@ -789,7 +808,7 @@ PERL_CALLCONV OP*   Perl_do_readline(pTHX)
                        __attribute__warn_unused_result__;
 
 PERL_CALLCONV bool     Perl_do_seek(pTHX_ GV* gv, Off_t pos, int whence);
-PERL_CALLCONV void     Perl_do_sprintf(pTHX_ SV* sv, I32 len, SV** sarg);
+PERL_CALLCONV void     Perl_do_sprintf(pTHX_ SV* sv, SSize_t len, SV** sarg);
 #define PERL_ARGS_ASSERT_DO_SPRINTF    \
        assert(sv); assert(sarg)
 PERL_CALLCONV void     Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim);
@@ -803,7 +822,7 @@ PERL_CALLCONV Off_t Perl_do_tell(pTHX_ GV* gv)
 #define PERL_ARGS_ASSERT_DO_TELL       \
        assert(gv)
 
-PERL_CALLCONV I32      Perl_do_trans(pTHX_ SV* sv);
+PERL_CALLCONV Size_t   Perl_do_trans(pTHX_ SV* sv);
 #define PERL_ARGS_ASSERT_DO_TRANS      \
        assert(sv)
 PERL_CALLCONV UV       Perl_do_vecget(pTHX_ SV* sv, STRLEN offset, int size);
@@ -1291,6 +1310,9 @@ PERL_CALLCONV SSize_t*    Perl_hv_placeholders_p(pTHX_ HV *hv)
 PERL_CALLCONV void     Perl_hv_placeholders_set(pTHX_ HV *hv, I32 ph);
 #define PERL_ARGS_ASSERT_HV_PLACEHOLDERS_SET   \
        assert(hv)
+PERL_CALLCONV void     Perl_hv_pushkv(pTHX_ HV *hv, U32 flags);
+#define PERL_ARGS_ASSERT_HV_PUSHKV     \
+       assert(hv)
 PERL_CALLCONV void     Perl_hv_rand_set(pTHX_ HV *hv, U32 new_xhv_rand);
 #define PERL_ARGS_ASSERT_HV_RAND_SET   \
        assert(hv)
@@ -1366,24 +1388,25 @@ PERL_CALLCONV bool      Perl_isIDFIRST_lazy(pTHX_ const char* p)
 #define PERL_ARGS_ASSERT_ISIDFIRST_LAZY        \
        assert(p)
 
-/* PERL_CALLCONV bool  Perl_is_ascii_string(const U8* const s, const STRLEN len)
+PERL_CALLCONV bool     Perl_isSCRIPT_RUN(pTHX_ const U8 *s, const U8 *send, const bool utf8_target)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_ISSCRIPT_RUN  \
+       assert(s); assert(send)
+
+/* PERL_CALLCONV bool  Perl_is_ascii_string(const U8* const s, STRLEN len)
                        __attribute__warn_unused_result__
                        __attribute__pure__; */
 
-#ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_c9strict_utf8_string(const U8 *s, const STRLEN len)
-                       __attribute__warn_unused_result__;
-#define PERL_ARGS_ASSERT_IS_C9STRICT_UTF8_STRING       \
-       assert(s)
-#endif
+/* PERL_CALLCONV bool  Perl_is_c9strict_utf8_string(const U8 *s, STRLEN len)
+                       __attribute__warn_unused_result__; */
 
-/* PERL_CALLCONV bool  is_c9strict_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); */
+/* PERL_CALLCONV bool  is_c9strict_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep); */
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_c9strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el);
+PERL_STATIC_INLINE bool        S_is_c9strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el);
 #define PERL_ARGS_ASSERT_IS_C9STRICT_UTF8_STRING_LOCLEN        \
        assert(s)
 #endif
-/* PERL_CALLCONV bool  Perl_is_invariant_string(const U8* const s, const STRLEN len)
+/* PERL_CALLCONV bool  Perl_is_invariant_string(const U8* const s, STRLEN len)
                        __attribute__warn_unused_result__
                        __attribute__pure__; */
 
@@ -1397,16 +1420,12 @@ PERL_STATIC_INLINE bool S_is_safe_syscall(pTHX_ const char *pv, STRLEN len, cons
        assert(pv); assert(what); assert(op_name)
 #endif
 
-#ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_strict_utf8_string(const U8 *s, const STRLEN len)
-                       __attribute__warn_unused_result__;
-#define PERL_ARGS_ASSERT_IS_STRICT_UTF8_STRING \
-       assert(s)
-#endif
+/* PERL_CALLCONV bool  Perl_is_strict_utf8_string(const U8 *s, STRLEN len)
+                       __attribute__warn_unused_result__; */
 
-/* PERL_CALLCONV bool  is_strict_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); */
+/* PERL_CALLCONV bool  is_strict_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep); */
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el);
+PERL_STATIC_INLINE bool        S_is_strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el);
 #define PERL_ARGS_ASSERT_IS_STRICT_UTF8_STRING_LOCLEN  \
        assert(s)
 #endif
@@ -1592,10 +1611,10 @@ PERL_CALLCONV bool      Perl_is_utf8_digit(pTHX_ const U8 *p)
 #define PERL_ARGS_ASSERT_IS_UTF8_DIGIT \
        assert(p)
 
-/* PERL_CALLCONV bool  is_utf8_fixed_width_buf_flags(const U8 * const s, const STRLEN len, const U32 flags); */
-/* PERL_CALLCONV bool  is_utf8_fixed_width_buf_loc_flags(const U8 * const s, const STRLEN len, const U8 **ep, const U32 flags); */
+/* PERL_CALLCONV bool  is_utf8_fixed_width_buf_flags(const U8 * const s, STRLEN len, const U32 flags); */
+/* PERL_CALLCONV bool  is_utf8_fixed_width_buf_loc_flags(const U8 * const s, STRLEN len, const U8 **ep, const U32 flags); */
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_utf8_fixed_width_buf_loclen_flags(const U8 * const s, const STRLEN len, const U8 **ep, STRLEN *el, const U32 flags);
+PERL_STATIC_INLINE bool        S_is_utf8_fixed_width_buf_loclen_flags(const U8 * const s, STRLEN len, const U8 **ep, STRLEN *el, const U32 flags);
 #define PERL_ARGS_ASSERT_IS_UTF8_FIXED_WIDTH_BUF_LOCLEN_FLAGS  \
        assert(s)
 #endif
@@ -1617,10 +1636,13 @@ PERL_CALLCONV bool      Perl_is_utf8_idfirst(pTHX_ const U8 *p)
 #define PERL_ARGS_ASSERT_IS_UTF8_IDFIRST       \
        assert(p)
 
+/* PERL_CALLCONV bool  is_utf8_invariant_string(const U8* const s, STRLEN len)
+                       __attribute__warn_unused_result__; */
+
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_utf8_invariant_string(const U8* const s, STRLEN const len)
+PERL_STATIC_INLINE bool        S_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep)
                        __attribute__warn_unused_result__;
-#define PERL_ARGS_ASSERT_IS_UTF8_INVARIANT_STRING      \
+#define PERL_ARGS_ASSERT_IS_UTF8_INVARIANT_STRING_LOC  \
        assert(s)
 #endif
 
@@ -1672,33 +1694,29 @@ PERL_CALLCONV bool      Perl_is_utf8_space(pTHX_ const U8 *p)
 #define PERL_ARGS_ASSERT_IS_UTF8_SPACE \
        assert(p)
 
-#ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        Perl_is_utf8_string(const U8 *s, const STRLEN len)
-                       __attribute__warn_unused_result__;
-#define PERL_ARGS_ASSERT_IS_UTF8_STRING        \
-       assert(s)
-#endif
+/* PERL_CALLCONV bool  Perl_is_utf8_string(const U8 *s, STRLEN len)
+                       __attribute__warn_unused_result__; */
 
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_utf8_string_flags(const U8 *s, const STRLEN len, const U32 flags)
+PERL_STATIC_INLINE bool        S_is_utf8_string_flags(const U8 *s, STRLEN len, const U32 flags)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_UTF8_STRING_FLAGS  \
        assert(s)
 #endif
 
 #ifndef NO_MATHOMS
-PERL_CALLCONV bool     Perl_is_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep);
+PERL_CALLCONV bool     Perl_is_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep);
 #define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOC    \
        assert(s); assert(ep)
 #endif
-/* PERL_CALLCONV bool  is_utf8_string_loc_flags(const U8 *s, const STRLEN len, const U8 **ep, const U32 flags); */
+/* PERL_CALLCONV bool  is_utf8_string_loc_flags(const U8 *s, STRLEN len, const U8 **ep, const U32 flags); */
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        Perl_is_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el);
+PERL_STATIC_INLINE bool        Perl_is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el);
 #define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN \
        assert(s)
 #endif
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_utf8_string_loclen_flags(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el, const U32 flags);
+PERL_STATIC_INLINE bool        S_is_utf8_string_loclen_flags(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el, const U32 flags);
 #define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN_FLAGS   \
        assert(s)
 #endif
@@ -1994,6 +2012,9 @@ PERL_CALLCONV int Perl_mg_free(pTHX_ SV* sv);
 PERL_CALLCONV void     Perl_mg_free_type(pTHX_ SV* sv, int how);
 #define PERL_ARGS_ASSERT_MG_FREE_TYPE  \
        assert(sv)
+PERL_CALLCONV void     Perl_mg_freeext(pTHX_ SV* sv, int how, const MGVTBL *vtbl);
+#define PERL_ARGS_ASSERT_MG_FREEEXT    \
+       assert(sv)
 PERL_CALLCONV int      Perl_mg_get(pTHX_ SV* sv);
 #define PERL_ARGS_ASSERT_MG_GET        \
        assert(sv)
@@ -2052,6 +2073,9 @@ PERL_CALLCONV void        Perl_mro_set_mro(pTHX_ struct mro_meta *const meta, SV *const
 PERL_CALLCONV SV*      Perl_mro_set_private_data(pTHX_ struct mro_meta *const smeta, const struct mro_alg *const which, SV *const data);
 #define PERL_ARGS_ASSERT_MRO_SET_PRIVATE_DATA  \
        assert(smeta); assert(which); assert(data)
+PERL_CALLCONV SV*      Perl_multiconcat_stringify(pTHX_ const OP* o);
+#define PERL_ARGS_ASSERT_MULTICONCAT_STRINGIFY \
+       assert(o)
 PERL_CALLCONV SV*      Perl_multideref_stringify(pTHX_ const OP* o, CV *cv);
 #define PERL_ARGS_ASSERT_MULTIDEREF_STRINGIFY  \
        assert(o)
@@ -2078,6 +2102,11 @@ PERL_CALLCONV Pid_t      Perl_my_fork(void);
 PERL_CALLCONV I32      Perl_my_lstat(pTHX);
 #endif
 PERL_CALLCONV I32      Perl_my_lstat_flags(pTHX_ const U32 flags);
+PERL_CALLCONV int      Perl_my_mkstemp_cloexec(char *templte)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_MY_MKSTEMP_CLOEXEC    \
+       assert(templte)
+
 PERL_CALLCONV PerlIO*  Perl_my_popen_list(pTHX_ const char* mode, int n, SV ** args);
 #define PERL_ARGS_ASSERT_MY_POPEN_LIST \
        assert(mode); assert(args)
@@ -2313,7 +2342,7 @@ PERL_CALLCONV SV* Perl_newSVpvf(pTHX_ const char *const pat, ...)
 #define PERL_ARGS_ASSERT_NEWSVPVF      \
        assert(pat)
 
-PERL_CALLCONV SV*      Perl_newSVpvn(pTHX_ const char *const s, const STRLEN len)
+PERL_CALLCONV SV*      Perl_newSVpvn(pTHX_ const char *const buffer, const STRLEN len)
                        __attribute__warn_unused_result__;
 
 PERL_CALLCONV SV*      Perl_newSVpvn_flags(pTHX_ const char *const s, const STRLEN len, const U32 flags)
@@ -2357,10 +2386,6 @@ PERL_CALLCONV CV *       Perl_newXS_flags(pTHX_ const char *name, XSUBADDR_t subaddr,
 PERL_CALLCONV CV *     Perl_newXS_len_flags(pTHX_ const char *name, STRLEN len, XSUBADDR_t subaddr, const char *const filename, const char *const proto, SV **const_svp, U32 flags);
 #define PERL_ARGS_ASSERT_NEWXS_LEN_FLAGS       \
        assert(subaddr)
-PERL_CALLCONV void     Perl_new_collate(pTHX_ const char* newcoll);
-PERL_CALLCONV void     Perl_new_ctype(pTHX_ const char* newctype);
-#define PERL_ARGS_ASSERT_NEW_CTYPE     \
-       assert(newctype)
 PERL_CALLCONV void     Perl_new_numeric(pTHX_ const char* newcoll);
 PERL_CALLCONV PERL_SI* Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems)
                        __attribute__warn_unused_result__;
@@ -2424,6 +2449,9 @@ PERL_CALLCONV void        Perl_op_refcnt_unlock(pTHX);
 PERL_CALLCONV OP*      Perl_op_scope(pTHX_ OP* o);
 PERL_CALLCONV OP*      Perl_op_sibling_splice(OP *parent, OP *start, int del_count, OP* insert);
 PERL_CALLCONV OP*      Perl_op_unscope(pTHX_ OP* o);
+PERL_CALLCONV void     Perl_optimize_optree(pTHX_ OP* o);
+#define PERL_ARGS_ASSERT_OPTIMIZE_OPTREE       \
+       assert(o)
 PERL_CALLCONV void     Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags);
 #define PERL_ARGS_ASSERT_PACK_CAT      \
        assert(cat); assert(pat); assert(patend); assert(beglist); assert(endlist); assert(next_in_list)
@@ -2665,9 +2693,9 @@ PERL_CALLCONV void        Perl_reg_numbered_buff_store(pTHX_ REGEXP * const rx, const I
 PERL_CALLCONV SV*      Perl_reg_qr_package(pTHX_ REGEXP * const rx);
 #define PERL_ARGS_ASSERT_REG_QR_PACKAGE        \
        assert(rx)
-PERL_CALLCONV REGEXP*  Perl_reg_temp_copy(pTHX_ REGEXP* ret_x, REGEXP* rx);
+PERL_CALLCONV REGEXP*  Perl_reg_temp_copy(pTHX_ REGEXP* dsv, REGEXP* ssv);
 #define PERL_ARGS_ASSERT_REG_TEMP_COPY \
-       assert(rx)
+       assert(ssv)
 PERL_CALLCONV SV*      Perl_regclass_swash(pTHX_ const regexp *prog, const struct regnode *node, bool doinit, SV **listsvp, SV **altsvp);
 #define PERL_ARGS_ASSERT_REGCLASS_SWASH        \
        assert(node)
@@ -2908,13 +2936,18 @@ PERL_CALLCONV void      Perl_set_caret_X(pTHX);
 PERL_CALLCONV void     Perl_set_context(void *t);
 #define PERL_ARGS_ASSERT_SET_CONTEXT   \
        assert(t)
-PERL_CALLCONV void     Perl_set_numeric_local(pTHX);
-PERL_CALLCONV void     Perl_set_numeric_radix(pTHX);
 PERL_CALLCONV void     Perl_set_numeric_standard(pTHX);
+PERL_CALLCONV void     Perl_set_numeric_underlying(pTHX);
 PERL_CALLCONV void     Perl_setdefout(pTHX_ GV* gv);
 #define PERL_ARGS_ASSERT_SETDEFOUT     \
        assert(gv)
-PERL_CALLCONV HEK*     Perl_share_hek(pTHX_ const char* str, I32 len, U32 hash);
+PERL_CALLCONV void     Perl_setfd_cloexec(int fd);
+PERL_CALLCONV void     Perl_setfd_cloexec_for_nonsysfd(pTHX_ int fd);
+PERL_CALLCONV void     Perl_setfd_cloexec_or_inhexec_by_sysfdness(pTHX_ int fd);
+PERL_CALLCONV void     Perl_setfd_inhexec(int fd);
+PERL_CALLCONV void     Perl_setfd_inhexec_for_sysfd(pTHX_ int fd);
+PERL_CALLCONV char*    Perl_setlocale(int category, const char* locale);
+PERL_CALLCONV HEK*     Perl_share_hek(pTHX_ const char* str, SSize_t len, U32 hash);
 #define PERL_ARGS_ASSERT_SHARE_HEK     \
        assert(str)
 PERL_CALLCONV void     Perl_sortsv(pTHX_ SV** array, size_t num_elts, SVCOMPARE_t cmp);
@@ -3289,6 +3322,9 @@ PERL_CALLCONV void        Perl_sv_reset(pTHX_ const char* s, HV *const stash);
 #define PERL_ARGS_ASSERT_SV_RESET      \
        assert(s)
 PERL_CALLCONV void     Perl_sv_resetpvn(pTHX_ const char* s, STRLEN len, HV *const stash);
+PERL_CALLCONV SV*      Perl_sv_rvunweaken(pTHX_ SV *const sv);
+#define PERL_ARGS_ASSERT_SV_RVUNWEAKEN \
+       assert(sv)
 PERL_CALLCONV SV*      Perl_sv_rvweaken(pTHX_ SV *const sv);
 #define PERL_ARGS_ASSERT_SV_RVWEAKEN   \
        assert(sv)
@@ -3377,6 +3413,7 @@ PERL_CALLCONV void        Perl_sv_setuv(pTHX_ SV *const sv, const UV num);
 PERL_CALLCONV void     Perl_sv_setuv_mg(pTHX_ SV *const sv, const UV u);
 #define PERL_ARGS_ASSERT_SV_SETUV_MG   \
        assert(sv)
+PERL_CALLCONV SV*      Perl_sv_string_from_errnum(pTHX_ int errnum, SV* tgtsv);
 #ifndef NO_MATHOMS
 PERL_CALLCONV void     Perl_sv_taint(pTHX_ SV* sv);
 #define PERL_ARGS_ASSERT_SV_TAINT      \
@@ -3454,10 +3491,10 @@ PERL_CALLCONV void      Perl_sv_vcatpvf(pTHX_ SV *const sv, const char *const pat, va
 PERL_CALLCONV void     Perl_sv_vcatpvf_mg(pTHX_ SV *const sv, const char *const pat, va_list *const args);
 #define PERL_ARGS_ASSERT_SV_VCATPVF_MG \
        assert(sv); assert(pat)
-PERL_CALLCONV void     Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted);
+PERL_CALLCONV void     Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const Size_t sv_count, bool *const maybe_tainted);
 #define PERL_ARGS_ASSERT_SV_VCATPVFN   \
        assert(sv); assert(pat)
-PERL_CALLCONV void     Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted, const U32 flags);
+PERL_CALLCONV void     Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const Size_t sv_count, bool *const maybe_tainted, const U32 flags);
 #define PERL_ARGS_ASSERT_SV_VCATPVFN_FLAGS     \
        assert(sv); assert(pat)
 PERL_CALLCONV void     Perl_sv_vsetpvf(pTHX_ SV *const sv, const char *const pat, va_list *const args);
@@ -3466,7 +3503,7 @@ PERL_CALLCONV void        Perl_sv_vsetpvf(pTHX_ SV *const sv, const char *const pat, va
 PERL_CALLCONV void     Perl_sv_vsetpvf_mg(pTHX_ SV *const sv, const char *const pat, va_list *const args);
 #define PERL_ARGS_ASSERT_SV_VSETPVF_MG \
        assert(sv); assert(pat)
-PERL_CALLCONV void     Perl_sv_vsetpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted);
+PERL_CALLCONV void     Perl_sv_vsetpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const Size_t sv_count, bool *const maybe_tainted);
 #define PERL_ARGS_ASSERT_SV_VSETPVFN   \
        assert(sv); assert(pat)
 PERL_CALLCONV UV       Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool do_utf8);
@@ -3515,11 +3552,6 @@ PERL_CALLCONV U32        Perl_to_uni_upper_lc(pTHX_ U32 c)
                        __attribute__deprecated__
                        __attribute__warn_unused_result__;
 
-PERL_CALLCONV UV       Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, const char *normal, const char *special)
-                       __attribute__deprecated__;
-#define PERL_ARGS_ASSERT_TO_UTF8_CASE  \
-       assert(p); assert(ustrp); assert(swashp); assert(normal)
-
 #ifndef NO_MATHOMS
 PERL_CALLCONV UV       Perl_to_utf8_fold(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp)
                        __attribute__deprecated__;
@@ -3550,10 +3582,10 @@ PERL_CALLCONV UV        Perl_to_utf8_upper(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp)
 
 PERL_CALLCONV bool     Perl_try_amagic_bin(pTHX_ int method, int flags);
 PERL_CALLCONV bool     Perl_try_amagic_un(pTHX_ int method, int flags);
-PERL_CALLCONV I32      Perl_unpack_str(pTHX_ const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags);
+PERL_CALLCONV SSize_t  Perl_unpack_str(pTHX_ const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags);
 #define PERL_ARGS_ASSERT_UNPACK_STR    \
        assert(pat); assert(patend); assert(s); assert(strend)
-PERL_CALLCONV I32      Perl_unpackstring(pTHX_ const char *pat, const char *patend, const char *s, const char *strend, U32 flags);
+PERL_CALLCONV SSize_t  Perl_unpackstring(pTHX_ const char *pat, const char *patend, const char *s, const char *strend, U32 flags);
 #define PERL_ARGS_ASSERT_UNPACKSTRING  \
        assert(pat); assert(patend); assert(s); assert(strend)
 PERL_CALLCONV void     Perl_unshare_hek(pTHX_ HEK* hek);
@@ -3603,14 +3635,13 @@ PERL_STATIC_INLINE U8*  Perl_utf8_hop_safe(const U8 *s, SSize_t off, const U8 *st
 #endif
 
 PERL_CALLCONV STRLEN   Perl_utf8_length(pTHX_ const U8* s, const U8 *e)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_UTF8_LENGTH   \
        assert(s); assert(e)
 
-PERL_CALLCONV U8*      Perl_utf8_to_bytes(pTHX_ U8 *s, STRLEN *len);
+PERL_CALLCONV U8*      Perl_utf8_to_bytes(pTHX_ U8 *s, STRLEN *lenp);
 #define PERL_ARGS_ASSERT_UTF8_TO_BYTES \
-       assert(s); assert(len)
+       assert(s); assert(lenp)
 PERL_CALLCONV UV       Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen)
                        __attribute__deprecated__;
 #define PERL_ARGS_ASSERT_UTF8_TO_UVCHR \
@@ -3664,7 +3695,7 @@ PERL_CALLCONV UV  Perl_valid_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen)
 #define PERL_ARGS_ASSERT_VALID_UTF8_TO_UVUNI   \
        assert(s)
 
-PERL_CALLCONV bool     Perl_validate_proto(pTHX_ SV *name, SV *proto, bool warn);
+PERL_CALLCONV bool     Perl_validate_proto(pTHX_ SV *name, SV *proto, bool warn, bool curstash);
 #define PERL_ARGS_ASSERT_VALIDATE_PROTO        \
        assert(name)
 PERL_CALLCONV int      Perl_vcmp(pTHX_ SV *lhv, SV *rhv);
@@ -3748,6 +3779,9 @@ PERL_CALLCONV I32 Perl_whichsig_pvn(pTHX_ const char* sig, STRLEN len);
 PERL_CALLCONV I32      Perl_whichsig_sv(pTHX_ SV* sigsv);
 #define PERL_ARGS_ASSERT_WHICHSIG_SV   \
        assert(sigsv)
+PERL_CALLCONV void     Perl_wrap_keyword_plugin(pTHX_ Perl_keyword_plugin_t new_plugin, Perl_keyword_plugin_t *old_plugin_p);
+#define PERL_ARGS_ASSERT_WRAP_KEYWORD_PLUGIN   \
+       assert(new_plugin); assert(old_plugin_p)
 PERL_CALLCONV void     Perl_wrap_op_checker(pTHX_ Optype opcode, Perl_check_t new_checker, Perl_check_t *old_checker_p);
 #define PERL_ARGS_ASSERT_WRAP_OP_CHECKER       \
        assert(new_checker); assert(old_checker_p)
@@ -3769,6 +3803,13 @@ PERL_CALLCONV int        Perl_yylex(pTHX);
 PERL_CALLCONV int      Perl_yyparse(pTHX_ int gramtype);
 PERL_CALLCONV void     Perl_yyquit(pTHX);
 PERL_CALLCONV void     Perl_yyunlex(pTHX);
+#if ! defined(HAS_MEMRCHR) && (defined(PERL_CORE) || defined(PERL_EXT))
+#ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE void *      S_my_memrchr(const char * s, const char c, const STRLEN len);
+#define PERL_ARGS_ASSERT_MY_MEMRCHR    \
+       assert(s)
+#endif
+#endif
 #if !(defined(DEBUGGING))
 #  if !defined(NV_PRESERVES_UV)
 #    if defined(PERL_IN_SV_C)
@@ -3786,6 +3827,14 @@ PERL_CALLCONV char*      Perl_ninstr(const char* big, const char* bigend, const char*
        assert(big); assert(bigend); assert(little); assert(lend)
 
 #endif
+#if !(defined(HAS_NL_LANGINFO) && defined(PERL_LANGINFO_H))
+PERL_CALLCONV const char*      Perl_langinfo(const int item);
+#endif
+#if !(defined(HAS_NL_LANGINFO))
+#  if defined(PERL_IN_LOCALE_C)
+STATIC const char*     S_my_nl_langinfo(const int item, bool toggle);
+#  endif
+#endif
 #if !(defined(HAS_SIGACTION) && defined(SA_SIGINFO))
 PERL_CALLCONV Signal_t Perl_csighandler(int sig);
 PERL_CALLCONV Signal_t Perl_sighandler(int sig);
@@ -3802,9 +3851,6 @@ PERL_CALLCONV void*       Perl_my_cxt_init(pTHX_ int *index, size_t size);
        assert(index)
 #  endif
 #endif
-#if !(defined(WIN32))
-/* PERL_CALLCONV char* my_setlocale(pTHX_ int category, const char* locale); */
-#endif
 #if !(defined(_MSC_VER))
 PERL_CALLCONV_NO_RET int       Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg)
                        __attribute__noreturn__;
@@ -3812,34 +3858,18 @@ PERL_CALLCONV_NO_RET int        Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg)
        assert(sv); assert(mg)
 
 #endif
-#if !defined(HAS_BZERO) && !defined(HAS_MEMSET)
-PERL_CALLCONV void*    Perl_my_bzero(void* vloc, size_t len);
-#define PERL_ARGS_ASSERT_MY_BZERO      \
-       assert(vloc)
+#if !defined(EBCDIC)
+#ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE unsigned int        S__variant_byte_number(PERL_UINTMAX_T word)
+                       __attribute__warn_unused_result__;
+#endif
+
 #endif
 #if !defined(HAS_GETENV_LEN)
 PERL_CALLCONV char*    Perl_getenv_len(pTHX_ const char *env_elem, unsigned long *len);
 #define PERL_ARGS_ASSERT_GETENV_LEN    \
        assert(env_elem); assert(len)
 #endif
-#if !defined(HAS_MEMCMP) || !defined(HAS_SANE_MEMCMP)
-PERL_CALLCONV int      Perl_my_memcmp(const void* vs1, const void* vs2, size_t len)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
-#define PERL_ARGS_ASSERT_MY_MEMCMP     \
-       assert(vs1); assert(vs2)
-
-#endif
-#if !defined(HAS_MEMCPY) || (!defined(HAS_MEMMOVE) && !defined(HAS_SAFE_MEMCPY))
-PERL_CALLCONV void*    Perl_my_bcopy(const void* vfrom, void* vto, size_t len);
-#define PERL_ARGS_ASSERT_MY_BCOPY      \
-       assert(vfrom); assert(vto)
-#endif
-#if !defined(HAS_MEMSET)
-PERL_CALLCONV void*    Perl_my_memset(void* vloc, int ch, size_t len);
-#define PERL_ARGS_ASSERT_MY_MEMSET     \
-       assert(vloc)
-#endif
 #if !defined(HAS_MKDIR) || !defined(HAS_RMDIR)
 #  if defined(PERL_IN_PP_SYS_C)
 STATIC int     S_dooneliner(pTHX_ const char *cmd, const char *filename)
@@ -3849,6 +3879,16 @@ STATIC int       S_dooneliner(pTHX_ const char *cmd, const char *filename)
 
 #  endif
 #endif
+#if !defined(HAS_MKOSTEMP)
+PERL_CALLCONV int      Perl_my_mkostemp(char *templte, int flags);
+#define PERL_ARGS_ASSERT_MY_MKOSTEMP   \
+       assert(templte)
+#endif
+#if !defined(HAS_MKSTEMP)
+PERL_CALLCONV int      Perl_my_mkstemp(char *templte);
+#define PERL_ARGS_ASSERT_MY_MKSTEMP    \
+       assert(templte)
+#endif
 #if !defined(HAS_RENAME)
 PERL_CALLCONV I32      Perl_same_dirent(pTHX_ const char* a, const char* b);
 #define PERL_ARGS_ASSERT_SAME_DIRENT   \
@@ -3866,6 +3906,11 @@ PERL_CALLCONV Size_t     Perl_my_strlcat(char *dst, const char *src, Size_t size);
 #if !defined(HAS_STRLCPY)
 PERL_CALLCONV Size_t   Perl_my_strlcpy(char *dst, const char *src, Size_t size);
 #endif
+#if !defined(HAS_STRNLEN)
+PERL_CALLCONV Size_t   Perl_my_strnlen(const char *str, Size_t maxlen);
+#define PERL_ARGS_ASSERT_MY_STRNLEN    \
+       assert(str)
+#endif
 #if !defined(HAS_TRUNCATE) && !defined(HAS_CHSIZE) && defined(F_FREESP)
 PERL_CALLCONV I32      Perl_my_chsize(pTHX_ int fd, Off_t length)
                        __attribute__warn_unused_result__;
@@ -4067,21 +4112,32 @@ STATIC void     S_validate_suid(pTHX_ PerlIO *rsfp);
        assert(rsfp)
 #  endif
 #endif
-#if !defined(SPRINTF_RETURNS_STRLEN)
-PERL_CALLCONV int      Perl_my_sprintf(char *buffer, const char *pat, ...);
-#define PERL_ARGS_ASSERT_MY_SPRINTF    \
-       assert(buffer); assert(pat)
-#endif
 #if !defined(USE_QUADMATH)
 #  if defined(PERL_IN_NUMERIC_C)
 STATIC NV      S_mulexp10(NV value, I32 exponent);
 #  endif
 #endif
+#if !defined(UV_IS_QUAD)
+#  if defined(PERL_IN_UTF8_C)
+STATIC int     S_is_utf8_cp_above_31_bits(const U8 * const s, const U8 * const e, const bool consider_overlongs)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_IS_UTF8_CP_ABOVE_31_BITS      \
+       assert(s); assert(e)
+
+#  endif
+#endif
 #if !defined(WIN32)
 PERL_CALLCONV bool     Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report);
 #define PERL_ARGS_ASSERT_DO_EXEC3      \
        assert(incmd)
 #endif
+#if defined (HAS_SOCKETPAIR) ||     (defined (HAS_SOCKET) && defined(SOCK_DGRAM) &&    defined(AF_INET) && defined(PF_INET))
+PERL_CALLCONV int      Perl_PerlSock_socketpair_cloexec(pTHX_ int domain, int type, int protocol, int *pairfd)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_PERLSOCK_SOCKETPAIR_CLOEXEC   \
+       assert(pairfd)
+
+#endif
 #if defined(DEBUGGING)
 PERL_CALLCONV int      Perl_get_debug_opts(pTHX_ const char **s, bool givehelp)
                        __attribute__warn_unused_result__;
@@ -4098,6 +4154,19 @@ PERL_CALLCONV SV*        Perl_pad_sv(pTHX_ PADOFFSET po);
 PERL_CALLCONV void     Perl_set_padlist(CV * cv, PADLIST * padlist);
 #define PERL_ARGS_ASSERT_SET_PADLIST   \
        assert(cv)
+#  if defined(PERL_IN_LOCALE_C)
+#    if defined(USE_LOCALE)
+STATIC void    S_print_bytes_for_locale(pTHX_ const char * const s, const char * const e, const bool is_utf8);
+#define PERL_ARGS_ASSERT_PRINT_BYTES_FOR_LOCALE        \
+       assert(s); assert(e)
+STATIC void    S_print_collxfrm_input_and_return(pTHX_ const char * const s, const char * const e, const STRLEN * const xlen, const bool is_utf8);
+#define PERL_ARGS_ASSERT_PRINT_COLLXFRM_INPUT_AND_RETURN       \
+       assert(s); assert(e)
+STATIC char *  S_setlocale_debug_string(const int category, const char* const locale, const char* const retval)
+                       __attribute__warn_unused_result__;
+
+#    endif
+#  endif
 #  if defined(PERL_IN_PAD_C)
 STATIC void    S_cv_dump(pTHX_ const CV *cv, const char *title);
 #define PERL_ARGS_ASSERT_CV_DUMP       \
@@ -4166,16 +4235,6 @@ STATIC int       S_tokereport(pTHX_ I32 rv, const YYSTYPE* lvalp);
 #define PERL_ARGS_ASSERT_TOKEREPORT    \
        assert(lvalp)
 #  endif
-#  if defined(USE_LOCALE)     && (defined(PERL_IN_LOCALE_C) || defined (PERL_EXT_POSIX))
-PERL_CALLCONV char *   Perl__setlocale_debug_string(const int category, const char* const locale, const char* const retval)
-                       __attribute__warn_unused_result__;
-
-#  endif
-#  if defined(USE_LOCALE) && defined(PERL_IN_LOCALE_C)
-STATIC void    S_print_collxfrm_input_and_return(pTHX_ const char * const s, const char * const e, const STRLEN * const xlen, const bool is_utf8);
-#define PERL_ARGS_ASSERT_PRINT_COLLXFRM_INPUT_AND_RETURN       \
-       assert(s); assert(e)
-#  endif
 #endif
 #if defined(DEBUGGING) && defined(ENABLE_REGEX_SETS_DEBUGGING)
 #  if defined(PERL_IN_REGCOMP_C)
@@ -4217,10 +4276,33 @@ PERL_CALLCONV I32       Perl_do_shmio(pTHX_ I32 optype, SV** mark, SV** sp);
 #define PERL_ARGS_ASSERT_DO_SHMIO      \
        assert(mark); assert(sp)
 #endif
+#if defined(HAS_NL_LANGINFO)
+#  if defined(PERL_IN_LOCALE_C)
+STATIC const char*     S_my_nl_langinfo(const nl_item item, bool toggle);
+#  endif
+#endif
+#if defined(HAS_NL_LANGINFO) && defined(PERL_LANGINFO_H)
+PERL_CALLCONV const char*      Perl_langinfo(const nl_item item);
+#endif
+#if defined(HAS_PIPE)
+PERL_CALLCONV int      Perl_PerlProc_pipe_cloexec(pTHX_ int *pipefd)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_PERLPROC_PIPE_CLOEXEC \
+       assert(pipefd)
+
+#endif
 #if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
 PERL_CALLCONV Signal_t Perl_csighandler(int sig, siginfo_t *info, void *uap);
 PERL_CALLCONV Signal_t Perl_sighandler(int sig, siginfo_t *info, void *uap);
 #endif
+#if defined(HAS_SOCKET)
+PERL_CALLCONV int      Perl_PerlSock_accept_cloexec(pTHX_ int listenfd, struct sockaddr *addr, Sock_size_t *addrlen)
+                       __attribute__warn_unused_result__;
+
+PERL_CALLCONV int      Perl_PerlSock_socket_cloexec(pTHX_ int domain, int type, int protocol)
+                       __attribute__warn_unused_result__;
+
+#endif
 #if defined(HAVE_INTERP_INTERN)
 PERL_CALLCONV void     Perl_sys_intern_clear(pTHX);
 PERL_CALLCONV void     Perl_sys_intern_init(pTHX);
@@ -4282,11 +4364,27 @@ PERL_CALLCONV void      Perl_Slab_to_rw(pTHX_ OPSLAB *const slab);
 #endif
 #if defined(PERL_CORE) || defined (PERL_EXT)
 #ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE bool        S_is_utf8_non_invariant_string(const U8* const s, STRLEN len)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_IS_UTF8_NON_INVARIANT_STRING  \
+       assert(s)
+#endif
+
+#ifndef PERL_NO_INLINE_FUNCTIONS
 PERL_STATIC_INLINE STRLEN      S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const char *pv, STRLEN pos, STRLEN *lenp);
 #define PERL_ARGS_ASSERT_SV_OR_PV_POS_U2B      \
        assert(sv); assert(pv)
 #endif
 #endif
+#if defined(PERL_CORE) || defined(PERL_EXT)
+#ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE Size_t      S_variant_under_utf8_count(const U8* const s, const U8* const e)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_VARIANT_UNDER_UTF8_COUNT      \
+       assert(s); assert(e)
+#endif
+
+#endif
 #if defined(PERL_CR_FILTER)
 #  if defined(PERL_IN_TOKE_C)
 STATIC I32     S_cr_textfilter(pTHX_ int idx, SV *sv, int maxlen);
@@ -4436,7 +4534,7 @@ STATIC void       S_exec_failed(pTHX_ const char *cmd, int fd, int do_report);
 STATIC bool    S_ingroup(pTHX_ Gid_t testgid, bool effective)
                        __attribute__warn_unused_result__;
 
-STATIC bool    S_openn_cleanup(pTHX_ GV *gv, IO *io, PerlIO *fp, char *mode, const char *oname, PerlIO *saveifp, PerlIO *saveofp, int savefd, char savetype, int writing, bool was_fdopen, const char *type);
+STATIC bool    S_openn_cleanup(pTHX_ GV *gv, IO *io, PerlIO *fp, char *mode, const char *oname, PerlIO *saveifp, PerlIO *saveofp, int savefd, char savetype, int writing, bool was_fdopen, const char *type, Stat_t *statbufp);
 #define PERL_ARGS_ASSERT_OPENN_CLEANUP \
        assert(gv); assert(io); assert(mode); assert(oname)
 STATIC IO *    S_openn_setup(pTHX_ GV *gv, char *mode, PerlIO **saveifp, PerlIO **saveofp, int *savefd, char *savetype);
@@ -4444,32 +4542,32 @@ STATIC IO *     S_openn_setup(pTHX_ GV *gv, char *mode, PerlIO **saveifp, PerlIO **s
        assert(gv); assert(mode); assert(saveifp); assert(saveofp); assert(savefd); assert(savetype)
 #endif
 #if defined(PERL_IN_DOOP_C)
-STATIC I32     S_do_trans_complex(pTHX_ SV * const sv)
+STATIC Size_t  S_do_trans_complex(pTHX_ SV * const sv)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_DO_TRANS_COMPLEX      \
        assert(sv)
 
-STATIC I32     S_do_trans_complex_utf8(pTHX_ SV * const sv)
+STATIC Size_t  S_do_trans_complex_utf8(pTHX_ SV * const sv)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_DO_TRANS_COMPLEX_UTF8 \
        assert(sv)
 
-STATIC I32     S_do_trans_count(pTHX_ SV * const sv)
+STATIC Size_t  S_do_trans_count(pTHX_ SV * const sv)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_DO_TRANS_COUNT        \
        assert(sv)
 
-STATIC I32     S_do_trans_count_utf8(pTHX_ SV * const sv)
+STATIC Size_t  S_do_trans_count_utf8(pTHX_ SV * const sv)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_DO_TRANS_COUNT_UTF8   \
        assert(sv)
 
-STATIC I32     S_do_trans_simple(pTHX_ SV * const sv)
+STATIC Size_t  S_do_trans_simple(pTHX_ SV * const sv)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_DO_TRANS_SIMPLE       \
        assert(sv)
 
-STATIC I32     S_do_trans_simple_utf8(pTHX_ SV * const sv)
+STATIC Size_t  S_do_trans_simple_utf8(pTHX_ SV * const sv)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_DO_TRANS_SIMPLE_UTF8  \
        assert(sv)
@@ -4536,9 +4634,6 @@ PERL_CALLCONV void        Perl_sv_add_backref(pTHX_ SV *const tsv, SV *const sv);
 STATIC void    S_clear_placeholders(pTHX_ HV *hv, U32 items);
 #define PERL_ARGS_ASSERT_CLEAR_PLACEHOLDERS    \
        assert(hv)
-STATIC void    S_hfreeentries(pTHX_ HV *hv);
-#define PERL_ARGS_ASSERT_HFREEENTRIES  \
-       assert(hv)
 STATIC void    S_hsplit(pTHX_ HV *hv, STRLEN const oldsize, STRLEN newsize);
 #define PERL_ARGS_ASSERT_HSPLIT        \
        assert(hv)
@@ -4552,6 +4647,9 @@ STATIC SV*        S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN k
 STATIC SV*     S_hv_free_ent_ret(pTHX_ HV *hv, HE *entry);
 #define PERL_ARGS_ASSERT_HV_FREE_ENT_RET       \
        assert(hv); assert(entry)
+STATIC void    S_hv_free_entries(pTHX_ HV *hv);
+#define PERL_ARGS_ASSERT_HV_FREE_ENTRIES       \
+       assert(hv)
 STATIC void    S_hv_magic_check(HV *hv, bool *needs_copy, bool *needs_store);
 #define PERL_ARGS_ASSERT_HV_MAGIC_CHECK        \
        assert(hv); assert(needs_copy); assert(needs_store)
@@ -4575,7 +4673,7 @@ STATIC HEK*       S_save_hek_flags(const char *str, I32 len, U32 hash, int flags)
 #define PERL_ARGS_ASSERT_SAVE_HEK_FLAGS        \
        assert(str)
 
-STATIC HEK*    S_share_hek_flags(pTHX_ const char *str, I32 len, U32 hash, int flags)
+STATIC HEK*    S_share_hek_flags(pTHX_ const char *str, STRLEN len, U32 hash, int flags)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_SHARE_HEK_FLAGS       \
        assert(str)
@@ -4592,6 +4690,27 @@ PERL_CALLCONV SV*        Perl_hfree_next_entry(pTHX_ HV *hv, STRLEN *indexp);
 #define PERL_ARGS_ASSERT_HFREE_NEXT_ENTRY      \
        assert(hv); assert(indexp)
 #endif
+#if defined(PERL_IN_LOCALE_C)
+STATIC const char*     S_category_name(const int category);
+#ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE const char *        S_save_to_buffer(const char * string, char **buf, Size_t *buf_size, const Size_t offset);
+#define PERL_ARGS_ASSERT_SAVE_TO_BUFFER        \
+       assert(string); assert(buf_size)
+#endif
+#  if defined(USE_LOCALE)
+STATIC void    S_new_collate(pTHX_ const char* newcoll);
+STATIC void    S_new_ctype(pTHX_ const char* newctype);
+#define PERL_ARGS_ASSERT_NEW_CTYPE     \
+       assert(newctype)
+STATIC void    S_set_numeric_radix(pTHX_ const bool use_locale);
+STATIC char*   S_stdize_locale(pTHX_ char* locs);
+#define PERL_ARGS_ASSERT_STDIZE_LOCALE \
+       assert(locs)
+#    if defined(WIN32)
+STATIC char*   S_win32_setlocale(pTHX_ int category, const char* locale);
+#    endif
+#  endif
+#endif
 #if defined(PERL_IN_LOCALE_C) || defined(PERL_IN_SV_C) || defined(PERL_IN_MATHOMS_C)
 #  if defined(USE_LOCALE_COLLATE)
 PERL_CALLCONV char*    Perl__mem_collxfrm(pTHX_ const char* input_string, STRLEN len, STRLEN* xlen, bool utf8);
@@ -4688,7 +4807,7 @@ STATIC bool       S_looks_like_bool(pTHX_ const OP* o);
 #define PERL_ARGS_ASSERT_LOOKS_LIKE_BOOL       \
        assert(o)
 STATIC OP*     S_modkids(pTHX_ OP *o, I32 type);
-STATIC void    S_move_proto_attr(pTHX_ OP **proto, OP **attrs, const GV *name);
+STATIC void    S_move_proto_attr(pTHX_ OP **proto, OP **attrs, const GV *name, bool curstash);
 #define PERL_ARGS_ASSERT_MOVE_PROTO_ATTR       \
        assert(proto); assert(attrs); assert(name)
 STATIC OP *    S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp);
@@ -4723,6 +4842,9 @@ PERL_STATIC_INLINE OP*    S_op_std_init(pTHX_ OP *o);
 #define PERL_ARGS_ASSERT_OP_STD_INIT   \
        assert(o)
 #endif
+STATIC void    S_optimize_op(pTHX_ OP* o);
+#define PERL_ARGS_ASSERT_OPTIMIZE_OP   \
+       assert(o)
 STATIC OP*     S_pmtrans(pTHX_ OP* o, OP* expr, OP* repl);
 #define PERL_ARGS_ASSERT_PMTRANS       \
        assert(o); assert(expr); assert(repl)
@@ -4848,7 +4970,7 @@ STATIC void       S_destroy_matcher(pTHX_ PMOP* matcher);
 #define PERL_ARGS_ASSERT_DESTROY_MATCHER       \
        assert(matcher)
 STATIC OP*     S_do_smartmatch(pTHX_ HV* seen_this, HV* seen_other, const bool copied);
-STATIC OP*     S_docatch(pTHX_ OP *o)
+STATIC OP*     S_docatch(pTHX_ Perl_ppaddr_t firstpp)
                        __attribute__warn_unused_result__;
 
 STATIC bool    S_doeval_compile(pTHX_ U8 gimme, CV* outside, U32 seq, HV* hh);
@@ -4934,7 +5056,7 @@ STATIC int        S_div128(pTHX_ SV *pnum, bool *done);
 STATIC char    S_first_symbol(const char *pat, const char *patend);
 #define PERL_ARGS_ASSERT_FIRST_SYMBOL  \
        assert(pat); assert(patend)
-STATIC const char *    S_get_num(pTHX_ const char *patptr, I32 *lenptr)
+STATIC const char *    S_get_num(pTHX_ const char *patptr, SSize_t *lenptr)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_GET_NUM       \
        assert(patptr); assert(lenptr)
@@ -4947,7 +5069,7 @@ STATIC SV*        S_is_an_int(pTHX_ const char *s, STRLEN l)
 #define PERL_ARGS_ASSERT_IS_AN_INT     \
        assert(s)
 
-STATIC I32     S_measure_struct(pTHX_ struct tempsym* symptr);
+STATIC SSize_t S_measure_struct(pTHX_ struct tempsym* symptr);
 #define PERL_ARGS_ASSERT_MEASURE_STRUCT        \
        assert(symptr)
 STATIC SV*     S_mul128(pTHX_ SV *sv, U8 m);
@@ -4972,7 +5094,7 @@ STATIC char *     S_sv_exp_grow(pTHX_ SV *sv, STRLEN needed)
 #define PERL_ARGS_ASSERT_SV_EXP_GROW   \
        assert(sv)
 
-STATIC I32     S_unpack_rec(pTHX_ struct tempsym* symptr, const char *s, const char *strbeg, const char *strend, const char **new_s);
+STATIC SSize_t S_unpack_rec(pTHX_ struct tempsym* symptr, const char *s, const char *strbeg, const char *strend, const char **new_s);
 #define PERL_ARGS_ASSERT_UNPACK_REC    \
        assert(symptr); assert(s); assert(strbeg); assert(strend)
 #endif
@@ -4986,9 +5108,6 @@ STATIC I32        S_amagic_i_ncmp(pTHX_ SV *const a, SV *const b);
 STATIC I32     S_amagic_ncmp(pTHX_ SV *const a, SV *const b);
 #define PERL_ARGS_ASSERT_AMAGIC_NCMP   \
        assert(a); assert(b)
-STATIC void    S_qsortsvu(pTHX_ SV** array, size_t num_elts, SVCOMPARE_t compare);
-#define PERL_ARGS_ASSERT_QSORTSVU      \
-       assert(compare)
 STATIC I32     S_sortcv(pTHX_ SV *const a, SV *const b);
 #define PERL_ARGS_ASSERT_SORTCV        \
        assert(a); assert(b)
@@ -5138,6 +5257,11 @@ STATIC U32       S_join_exact(pTHX_ RExC_state_t *pRExC_state, regnode *scan, UV *min_
 STATIC I32     S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *first, regnode *last, regnode *tail, U32 word_count, U32 flags, U32 depth);
 #define PERL_ARGS_ASSERT_MAKE_TRIE     \
        assert(pRExC_state); assert(startbranch); assert(first); assert(last); assert(tail)
+STATIC bool    S_new_regcurly(const char *s, const char *e)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_NEW_REGCURLY  \
+       assert(s); assert(e)
+
 STATIC void    S_nextchar(pTHX_ RExC_state_t *pRExC_state);
 #define PERL_ARGS_ASSERT_NEXTCHAR      \
        assert(pRExC_state)
@@ -5350,15 +5474,15 @@ PERL_STATIC_INLINE char*        S_form_short_octal_warning(pTHX_ const char * const s,
 PERL_CALLCONV char     Perl_grok_bslash_c(pTHX_ const char source, const bool output_warning)
                        __attribute__warn_unused_result__;
 
-PERL_CALLCONV bool     Perl_grok_bslash_o(pTHX_ char** s, UV* uv, const char** error_msg, const bool output_warning, const bool strict, const bool silence_non_portable, const bool utf8)
+PERL_CALLCONV bool     Perl_grok_bslash_o(pTHX_ char** s, const char* const send, UV* uv, const char** error_msg, const bool output_warning, const bool strict, const bool silence_non_portable, const bool utf8)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_GROK_BSLASH_O \
-       assert(s); assert(uv); assert(error_msg)
+       assert(s); assert(send); assert(uv); assert(error_msg)
 
-PERL_CALLCONV bool     Perl_grok_bslash_x(pTHX_ char** s, UV* uv, const char** error_msg, const bool output_warning, const bool strict, const bool silence_non_portable, const bool utf8)
+PERL_CALLCONV bool     Perl_grok_bslash_x(pTHX_ char** s, const char* const send, UV* uv, const char** error_msg, const bool output_warning, const bool strict, const bool silence_non_portable, const bool utf8)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_GROK_BSLASH_X \
-       assert(s); assert(uv); assert(error_msg)
+       assert(s); assert(send); assert(uv); assert(error_msg)
 
 #ifndef PERL_NO_INLINE_FUNCTIONS
 PERL_STATIC_INLINE I32 S_regcurly(const char *s)
@@ -5442,6 +5566,16 @@ STATIC char*     S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, cons
 #define PERL_ARGS_ASSERT_FIND_BYCLASS  \
        assert(prog); assert(c); assert(s); assert(strend)
 
+STATIC char *  S_find_next_ascii(char* s, const char * send, const bool is_utf8)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_FIND_NEXT_ASCII       \
+       assert(s); assert(send)
+
+STATIC char *  S_find_next_non_ascii(char* s, const char * send, const bool is_utf8)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_FIND_NEXT_NON_ASCII   \
+       assert(s); assert(send)
+
 STATIC bool    S_isFOO_utf8_lc(pTHX_ const U8 classnum, const U8* character)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_ISFOO_UTF8_LC \
@@ -5554,7 +5688,7 @@ STATIC void       S_assert_uft8_cache_coherent(pTHX_ const char *const func, STRLEN fr
 STATIC bool    S_curse(pTHX_ SV * const sv, const bool check_refcnt);
 #define PERL_ARGS_ASSERT_CURSE \
        assert(sv)
-STATIC I32     S_expect_number(pTHX_ char **const pattern)
+STATIC STRLEN  S_expect_number(pTHX_ const char **const pattern)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_EXPECT_NUMBER \
        assert(pattern)
@@ -5680,19 +5814,19 @@ STATIC SV*      S_get_and_check_backslash_N_name(pTHX_ const char* s, const char* con
 #define PERL_ARGS_ASSERT_GET_AND_CHECK_BACKSLASH_N_NAME        \
        assert(s); assert(e)
 
-STATIC void    S_incline(pTHX_ const char *s);
+STATIC void    S_incline(pTHX_ const char *s, const char *end);
 #define PERL_ARGS_ASSERT_INCLINE       \
-       assert(s)
+       assert(s); assert(end)
 STATIC int     S_intuit_method(pTHX_ char *s, SV *ioname, CV *cv);
 #define PERL_ARGS_ASSERT_INTUIT_METHOD \
        assert(s)
-STATIC int     S_intuit_more(pTHX_ char *s);
+STATIC int     S_intuit_more(pTHX_ char *s, char *e);
 #define PERL_ARGS_ASSERT_INTUIT_MORE   \
-       assert(s)
+       assert(s); assert(e)
 STATIC I32     S_lop(pTHX_ I32 f, U8 x, char *s);
 #define PERL_ARGS_ASSERT_LOP   \
        assert(s)
-PERL_STATIC_NO_RET void        S_missingterm(pTHX_ char *s)
+PERL_STATIC_NO_RET void        S_missingterm(pTHX_ char *s, STRLEN len)
                        __attribute__noreturn__;
 
 STATIC SV*     S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, STRLEN keylen, SV *sv, SV *pv, const char *type, STRLEN typelen);
@@ -5701,7 +5835,7 @@ STATIC SV*        S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, STRL
 STATIC void    S_no_op(pTHX_ const char *const what, char *s);
 #define PERL_ARGS_ASSERT_NO_OP \
        assert(what)
-STATIC void    S_parse_ident(pTHX_ char **s, char **d, char * const e, int allow_package, bool is_utf8, bool check_dollar);
+STATIC void    S_parse_ident(pTHX_ char **s, char **d, char * const e, int allow_package, bool is_utf8, bool check_dollar, bool tick_warn);
 #define PERL_ARGS_ASSERT_PARSE_IDENT   \
        assert(s); assert(d); assert(e)
 STATIC int     S_pending_ident(pTHX);
@@ -5801,14 +5935,14 @@ STATIC UV       S_check_locale_boundary_crossing(pTHX_ const U8* const p, const UV res
        assert(p); assert(ustrp); assert(lenp)
 
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_does_utf8_overflow(const U8 * const s, const U8 * e)
+PERL_STATIC_INLINE int S_does_utf8_overflow(const U8 * const s, const U8 * e, const bool consider_overlongs)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_DOES_UTF8_OVERFLOW    \
        assert(s); assert(e)
 #endif
 
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_isFF_OVERLONG(const U8 * const s, const STRLEN len)
+PERL_STATIC_INLINE int S_isFF_OVERLONG(const U8 * const s, const STRLEN len)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_ISFF_OVERLONG \
        assert(s)
@@ -5829,14 +5963,7 @@ PERL_STATIC_INLINE bool  S_is_utf8_common_with_len(pTHX_ const U8 *const p, const
 #endif
 
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_utf8_cp_above_31_bits(const U8 * const s, const U8 * const e)
-                       __attribute__warn_unused_result__;
-#define PERL_ARGS_ASSERT_IS_UTF8_CP_ABOVE_31_BITS      \
-       assert(s); assert(e)
-#endif
-
-#ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_utf8_overlong_given_start_byte_ok(const U8 * const s, const STRLEN len)
+PERL_STATIC_INLINE int S_is_utf8_overlong_given_start_byte_ok(const U8 * const s, const STRLEN len)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_UTF8_OVERLONG_GIVEN_START_BYTE_OK  \
        assert(s)
@@ -6043,14 +6170,9 @@ PERL_CALLCONV SV*        Perl_sv_dup_inc(pTHX_ const SV *const sstr, CLONE_PARAMS *cons
        assert(param)
 
 #endif
-#if defined(USE_LOCALE)     && (defined(PERL_IN_LOCALE_C) || defined (PERL_EXT_POSIX))
+#if defined(USE_LOCALE)                    && (   defined(PERL_IN_LOCALE_C)            || defined(PERL_IN_MG_C)                || defined (PERL_EXT_POSIX))
 PERL_CALLCONV bool     Perl__is_cur_LC_category_utf8(pTHX_ int category);
 #endif
-#if defined(USE_LOCALE) && defined(PERL_IN_LOCALE_C)
-STATIC char*   S_stdize_locale(pTHX_ char* locs);
-#define PERL_ARGS_ASSERT_STDIZE_LOCALE \
-       assert(locs)
-#endif
 #if defined(USE_LOCALE_COLLATE)
 PERL_CALLCONV int      Perl_magic_setcollxfrm(pTHX_ SV* sv, MAGIC* mg);
 #define PERL_ARGS_ASSERT_MAGIC_SETCOLLXFRM     \
@@ -6116,7 +6238,6 @@ PERL_CALLCONV const char* Perl_quadmath_format_single(const char* format);
        assert(format)
 #endif
 #if defined(WIN32)
-PERL_CALLCONV char*    Perl_my_setlocale(pTHX_ int category, const char* locale);
 PERL_CALLCONV_NO_RET void      win32_croak_not_implemented(const char * fname)
                        __attribute__noreturn__;
 #define PERL_ARGS_ASSERT_WIN32_CROAK_NOT_IMPLEMENTED   \