Commit c79142873c for perl

commit c79142873c2be7d205e65da030f70db8ab8f48ba
Author: Richard Leach <rich+perl@hyphen-dash-hyphen.info>
Date:   Thu Sep 10 20:45:45 2026 +0000

    Use newSV_type_generic when type is unknown or rare

    Avoid binary bloating when the target type is not known at compile time,
    or the call site/type is pretty cold.

diff --git a/gv.c b/gv.c
index bf47e01e75..5ae628e20c 100644
--- a/gv.c
+++ b/gv.c
@@ -96,7 +96,7 @@ Perl_gv_add_by_type(pTHX_ GV *gv, svtype type)

     if (!*where)
     {
-        *where = newSV_type(type);
+        *where = newSV_type_generic(type);
         if (   type == SVt_PVAV
             && memEQs(GvNAME(gv), GvNAMELEN(gv), "ISA"))
         {
diff --git a/pad.c b/pad.c
index 7f1148a500..a17ba11524 100644
--- a/pad.c
+++ b/pad.c
@@ -2282,7 +2282,7 @@ S_cv_clone(pTHX_ CV *proto, CV *cv, CV *outside, HV *cloned)

     assert(!CvUNIQUE(proto));

-    if (!cv) cv = MUTABLE_CV(newSV_type(SvTYPE(proto)));
+    if (!cv) cv = MUTABLE_CV(newSV_type_generic(SvTYPE(proto)));
     CvFLAGS(cv) = CvFLAGS(proto) & ~(CVf_CLONE|CVf_WEAKOUTSIDE|CVf_CVGV_RC
                                     |CVf_SLABBED);
     CvCLONED_on(cv);
diff --git a/sv.c b/sv.c
index d1a873e4c1..e5b208fe70 100644
--- a/sv.c
+++ b/sv.c
@@ -6148,7 +6148,7 @@ Perl_sv_force_normal_flags(pTHX_ SV *const sv, const U32 flags)
         const bool islv = SvTYPE(sv) == SVt_PVLV;
         const svtype new_type =
           islv ? SVt_NULL : SvMAGIC(sv) || SvSTASH(sv) ? SVt_PVMG : SVt_PV;
-        SV *const temp = newSV_type(new_type);
+        SV *const temp = newSV_type_generic(new_type);
         regexp *old_rx_body;

         if (new_type == SVt_PVMG) {
diff --git a/sv.h b/sv.h
index 7b1dea6f5c..5d841d557f 100644
--- a/sv.h
+++ b/sv.h
@@ -2861,7 +2861,7 @@ Create a new IO, setting the reference count to 1.

 =cut
 */
-#define newIO()	MUTABLE_IO(newSV_type(SVt_PVIO))
+#define newIO()	MUTABLE_IO(newSV_type_generic(SVt_PVIO))

 #if defined(PERL_CORE) || defined(PERL_EXT)

diff --git a/toke.c b/toke.c
index ee46e4cbea..472548eff8 100644
--- a/toke.c
+++ b/toke.c
@@ -13670,7 +13670,7 @@ Perl_start_subparse(pTHX_ I32 is_format, U32 flags)
     save_item(PL_subname);
     SAVESPTR(PL_compcv);

-    PL_compcv = MUTABLE_CV(newSV_type(is_format ? SVt_PVFM : SVt_PVCV));
+    PL_compcv = MUTABLE_CV(newSV_type_generic(is_format ? SVt_PVFM : SVt_PVCV));
     CvFLAGS(PL_compcv) |= flags;

     PL_subline = CopLINE(PL_curcop);