Commit 2cd20cadb4 for perl

commit 2cd20cadb44e2bc40bae86df17b05a972a6bea30
Author: Yves Orton <demerphq@gmail.com>
Date:   Tue Oct 27 21:36:48 2026 +0100

    regcomp: name WHILEM cache slot

    Use WHILEM_CACHE_SLOT for the cache index stored in WHILEM flags. The
    accessor identifies this value consistently in the compiler, debugger,
    and executor while leaving the stored representation unchanged.

diff --git a/regcomp.h b/regcomp.h
index 814b27b919..317fbc0a3b 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -648,6 +648,13 @@ struct regnode_ssc {
     FLAGS(p) = (val);                                                         \
 } STMT_END

+#define WHILEM_CACHE_SLOT(p)                                                  \
+    (assert(OP(p) == WHILEM), PREVENT_LVALUE(FLAGS(p)))
+#define WHILEM_CACHE_SLOT_SET(p, val) STMT_START {                            \
+    assert(OP(p) == WHILEM);                                                  \
+    FLAGS(p) = (val);                                                         \
+} STMT_END
+
 #define LOGICAL_MODE(p)                                                       \
     (assert(OP(p) == LOGICAL), PREVENT_LVALUE(FLAGS(p) & EVAL_FLAGS_MASK))
 #define LOGICAL_MODE_SET(p, val) STMT_START {                                 \
diff --git a/regcomp_debug.c b/regcomp_debug.c
index 43bd1a8ae0..79655362ec 100644
--- a/regcomp_debug.c
+++ b/regcomp_debug.c
@@ -646,8 +646,8 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
             sv_catpvf(sv, "%u", (unsigned) hi);
         sv_catpvs(sv, "}");
     }
-    else if (k == WHILEM && FLAGS(o))                   /* Ordinal/of */
-        sv_catpvf(sv, "[%d/%d]", (int)FLAGS(o), (int)progi->slc_whilem_seen);
+    else if (k == WHILEM && WHILEM_CACHE_SLOT(o))                   /* Ordinal/of */
+        sv_catpvf(sv, "[%d/%d]", (int)WHILEM_CACHE_SLOT(o), (int)progi->slc_whilem_seen);
     else if (k == REF || k == OPEN || k == CLOSE
              || k == GROUPP || op == ACCEPT)
     {
diff --git a/regcomp_study.c b/regcomp_study.c
index d644bb9146..cc08d4c7de 100644
--- a/regcomp_study.c
+++ b/regcomp_study.c
@@ -2846,13 +2846,13 @@ Perl_study_chunk(pTHX_
                     nxt = REGNODE_BEFORE(nxt);
                     if (
                         /* we've not already set WHILEM count on this node */
-                        !FLAGS(nxt)
+                        !WHILEM_CACHE_SLOT(nxt)
                         /* max supported number of WHILEM nodes that can
                          * participate in super-linear cache */
                       && RExC_rxi->slc_whilem_seen < SLC_MAX_WHILEM_NODES)
                     {
                         ++RExC_rxi->slc_whilem_seen;
-                        FLAGS(nxt) = RExC_rxi->slc_whilem_seen; /* On WHILEM */
+                        WHILEM_CACHE_SLOT_SET(nxt, RExC_rxi->slc_whilem_seen); /* On WHILEM */
                     }
                 }
                 if (data && fl & (SF_HAS_PAR|SF_IN_PAR))
diff --git a/regexec.c b/regexec.c
index 6fd07baee4..6a526ca838 100644
--- a/regexec.c
+++ b/regexec.c
@@ -6940,7 +6940,7 @@ S_backup_one_WB_but_over_Extend_FO(pTHX_ WB_enum * previous,
                 REGNODE_BEFORE(regnext(cur_curlyx->u.curlyx.me));      \
             re_exec_indentf(                                           \
                 "WHILEM[%d/%d]: (cache) marking failure at pos %" UVuf "\n",  \
-                depth, (int)FLAGS(whilem), (int)rexi->slc_whilem_seen, \
+                depth, (int)WHILEM_CACHE_SLOT(whilem), (int)rexi->slc_whilem_seen, \
                 (UV)(locinput - reginfo->strbeg));                     \
         });                                                            \
        *ST.slc_byte |= ST.slc_mask;                                    \
@@ -9677,7 +9677,7 @@ NULL
                 goto do_whilem_B_max;
             }

-            if (   FLAGS(scan)
+            if (   WHILEM_CACHE_SLOT(scan)
                    /* not running a (??{...}) or (?N) sub-pattern */
                 && !cur_eval)
             {
@@ -9687,7 +9687,7 @@ NULL
                  * background on how this works.
                  *
                  * For WHILEM nodes which can participate in the cache
-                 * (FLAGS() is non-zero), the processing at this point is
+                 * (WHILEM_CACHE_SLOT() is non-zero), the processing at this point is
                  * to first initiate a countdown. Then when on subsequent
                  * iterations that reaches zero, the match has likely gone
                  * super-linear and the per-WHILEM cache is allocated and
@@ -9696,7 +9696,7 @@ NULL
                 assert(rexi->slc);
                 assert(reginfo->info_aux->slc);
                 struct slc_cache_item *item =
-                                &reginfo->info_aux->slc[FLAGS(scan)-1];
+                                &reginfo->info_aux->slc[WHILEM_CACHE_SLOT(scan)-1];

                 if (item->slc_bitmap) {
                     /* Cache is live */
@@ -9712,7 +9712,7 @@ NULL
                         DEBUG_EXECUTE_r( re_exec_indentf(
                             "WHILEM[%d/%d]: (cache) already failed at pos %"
                                                                     UVuf "\n",
-                            depth, (int)FLAGS(scan),
+                            depth, (int)WHILEM_CACHE_SLOT(scan),
                             (int)rexi->slc_whilem_seen,
                             (UV)(locinput - reginfo->strbeg))
                         );
@@ -9741,7 +9741,7 @@ NULL
                         DEBUG_EXECUTE_r( re_exec_indentf(
                             "%sWHILEM[%d/%d]: detected a super-linear match, enabling cache%s...\n",
                             depth, PL_colors[4],
-                            (int)FLAGS(scan),
+                            (int)WHILEM_CACHE_SLOT(scan),
                             (int)rexi->slc_whilem_seen,
                             PL_colors[5]
                         ));