Commit 9fdaf5ba0b for perl
commit 9fdaf5ba0b0ec492ae9896c04e5c1d559d92dfdd
Author: David Mitchell <davem@iabyn.nospamdeletethisbit.com>
Date: Sat Oct 10 19:07:51 2026 +0100
add FOO_MULTICALL_FLAGS_PREFIX_ macros
As an expansion of the existing PUSH_MULTICALL_FLAGS etc macros,
add a similar set of PUSH_MULTICALL_FLAGS_PREFIX_ etc macros. These
are not public API.
The difference is that they allow a prefix to be specified when
accessing internal state variables. So whereas the current macros are
hard-coded to directly access the local variables declared by
dMULTICALL, it will be possible to instead make the current state into
fields within a struct. For example
PUSH_MULTICALL_FLAGS_PREFIX_(newcv, flags, reginfo->)
would now access the multicall_oldcatch "variable" as
reginfo->multicall_oldcatch.
These macros will be used in the next commit.
diff --git a/cop.h b/cop.h
index 8ad9ec4075..fc2264c085 100644
--- a/cop.h
+++ b/cop.h
@@ -1437,16 +1437,26 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
#define PUSH_MULTICALL(the_cv) \
PUSH_MULTICALL_FLAGS(the_cv, 0)
+/* The _PREFIX_ variants allow the dMULTICALL variables to be fields
+ * within a struct, with the prefix param intended to be something like
+ * 'foo->'. For core use only; not API. */
+
+/* expands to no text */
+#define PERL_MULTICALL_EMPTY_
+
/* Like PUSH_MULTICALL, but allows you to specify extra flags
* for the CX stack entry (this isn't part of the public API) */
#define PUSH_MULTICALL_FLAGS(the_cv, flags) \
+ PUSH_MULTICALL_FLAGS_PREFIX_(the_cv, flags, PERL_MULTICALL_EMPTY_)
+
+#define PUSH_MULTICALL_FLAGS_PREFIX_(the_cv, flags, prefix) \
STMT_START { \
PERL_CONTEXT *cx; \
CV * const nOnclAshIngNamE_ = the_cv; \
CV * const cv = nOnclAshIngNamE_; \
PADLIST * const padlist = CvPADLIST(cv); \
- multicall_oldcatch = CATCH_GET; \
+ prefix multicall_oldcatch = CATCH_GET; \
CATCH_SET(TRUE); \
PUSHSTACKi(PERLSI_MULTICALL); \
cx = cx_pushblock((CXt_SUB|CXp_MULTICALL|flags), (U8)gimme, \
@@ -1458,16 +1468,22 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
if (CvDEPTH(cv) >= 2) \
Perl_pad_push(aTHX_ padlist, CvDEPTH(cv)); \
PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); \
- multicall_cop = CvSTART(cv); \
+ prefix multicall_cop = CvSTART(cv); \
} STMT_END
#define MULTICALL \
+ MULTICALL_PREFIX_(PERL_MULTICALL_EMPTY_)
+
+#define MULTICALL_PREFIX_(prefix) \
STMT_START { \
- PL_op = multicall_cop; \
+ PL_op = prefix multicall_cop; \
CALLRUNOPS(aTHX); \
} STMT_END
#define POP_MULTICALL \
+ POP_MULTICALL_PREFIX_(PERL_MULTICALL_EMPTY_)
+
+#define POP_MULTICALL_PREFIX_(prefix) \
STMT_START { \
PERL_CONTEXT *cx; \
cx = CX_CUR(); \
@@ -1478,7 +1494,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
cx_popblock(cx); \
CX_POP(cx); \
POPSTACK; \
- CATCH_SET(multicall_oldcatch); \
+ CATCH_SET(prefix multicall_oldcatch); \
SPAGAIN; \
} STMT_END
@@ -1486,6 +1502,9 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
* (this isn't part of the public API) */
#define CHANGE_MULTICALL_FLAGS(the_cv, flags) \
+ CHANGE_MULTICALL_FLAGS_PREFIX_(the_cv, flags, PERL_MULTICALL_EMPTY_)
+
+#define CHANGE_MULTICALL_FLAGS_PREFIX_(the_cv, flags, prefix) \
STMT_START { \
CV * const nOnclAshIngNamE_ = the_cv; \
CV * const cv = nOnclAshIngNamE_; \
@@ -1500,8 +1519,10 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
if (CvDEPTH(cv) >= 2) \
Perl_pad_push(aTHX_ padlist, CvDEPTH(cv)); \
PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); \
- multicall_cop = CvSTART(cv); \
+ prefix multicall_cop = CvSTART(cv); \
} STMT_END
+
+
/*
* ex: set ts=8 sts=4 sw=4 et:
*/
diff --git a/regen/embed.pl b/regen/embed.pl
index 3051a91a6b..a4ed465e03 100755
--- a/regen/embed.pl
+++ b/regen/embed.pl
@@ -3207,6 +3207,7 @@ my %undocumented_always_visible = map { $_ => 1 } qw(
VALUEMAGIC_FROM
assert_scalar_or_IO_
+ CHANGE_MULTICALL_FLAGS_PREFIX_
DEBUG__
DEBUG_A_TEST_
DEBUG_BOTH_FLAGS_TEST_
@@ -3251,6 +3252,7 @@ my %undocumented_always_visible = map { $_ => 1 } qw(
MEM_WRAP_WILL_WRAP_
MGv2_ASSERT_AND_CAST_FUNCS_
MGv2_SIZEOF_FLAGS_
+ MULTICALL_PREFIX_
NV_BODYLESS_UNION_
OFFUNISKIP_helper_
OPpCALLER_PKG
@@ -3267,6 +3269,7 @@ my %undocumented_always_visible = map { $_ => 1 } qw(
OPpREF_CMP_NE
OPpREF_CMP_REGEXP_PKG
OPpREF_CMP_SKIPLOGOP
+ POP_MULTICALL_PREFIX_
pTHX_2
pTHX_3
pTHX_4
@@ -3278,6 +3281,7 @@ my %undocumented_always_visible = map { $_ => 1 } qw(
pTHX_10
pTHX_11
pTHX_12
+ PUSH_MULTICALL_FLAGS_PREFIX_
RXf_PMf_CHARSET_SHIFT_
RXf_PMf_SHIFT_COMPILETIME_
RXf_PMf_SHIFT_NEXT_