Commit 3cd722c1b8 for perl
commit 3cd722c1b878da8c72df7371491525252bce807c
Author: Richard Leach <rich+perl@hyphen-dash-hyphen.info>
Date: Wed Nov 4 14:10:26 2026 +0000
pp_subst: force_on_match directly calls sv_pvn_force_flags
`force_on_match = TRUE` is typically unlikely, with the resulting code
flow through `SvPV_force_nomg` in the two cold branches very likely to
result in a call to `sv_pvn_force_flags`.
This commit makes the call to `sv_pvn_force_flags` explicit and direct,
simplifying the preprocessed code and reducing function size.
diff --git a/pp_hot.c b/pp_hot.c
index e474888d4c..df0754bccd 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -5591,7 +5591,7 @@ PP(pp_subst)
/* redo the first match, this time with the orig var
* forced into being a string */
force_on_match = 0;
- orig = SvPV_force_nomg(TARG, len);
+ orig = sv_pvn_force_flags(TARG, &len, 0);
goto force_it;
}
@@ -5682,7 +5682,7 @@ PP(pp_subst)
* earlier COW check. Don't double-GET. */
TARG = sv_mortalcopy_flags(TARG, SV_NOSTEAL);
}
- orig = SvPV_force_nomg(TARG, len);
+ orig = sv_pvn_force_flags(TARG, &len, 0);
goto force_it;
}
#ifdef PERL_ANY_COW