From 57d3a7bbda0faeba04821df4f4023a94c004fde5 Mon Sep 17 00:00:00 2001 From: bulk88 Date: Fri, 28 Mar 2025 08:30:15 -0400 Subject: [PATCH] pp.c: pp_clonecv reorder TARGs init vs use, universal.c: remove a strlen dTARGET macro, and macro ARGTARG both deref PL_op. find_runcv() is a fn. Reorder dTARGET to be after the find_runcv() call so the CC -O1 dedupes reading inside the OP * between dTARGET/ARGTARG. Remove 2 strlen() calls at proc start inside Perl_boot_core_UNIVERSAL(). --- pp.c | 5 +++-- universal.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pp.c b/pp.c index b24cd428496b..5ecf7a27ebf2 100644 --- a/pp.c +++ b/pp.c @@ -62,12 +62,13 @@ PP(pp_introcv) PP(pp_clonecv) { - dTARGET; + CV * const protocv = PadnamePROTOCV( PadlistNAMESARRAY(CvPADLIST(find_runcv(NULL)))[ARGTARG] ); - assert(SvTYPE(TARG) == SVt_PVCV); assert(protocv); + dTARGET; + assert(SvTYPE(TARG) == SVt_PVCV); if (CvISXSUB(protocv)) { /* constant */ /* XXX Should we clone it here? */ /* If this changes to use SAVECLEARSV, we can move the SAVECLEARSV diff --git a/universal.c b/universal.c index bd9d6397352b..dec8cd5ac908 100644 --- a/universal.c +++ b/universal.c @@ -1436,8 +1436,10 @@ Perl_boot_core_UNIVERSAL(pTHX) /* Providing a Regexp::DESTROY fixes #21347. See test in t/op/ref.t */ { - CV * const cv = - newCONSTSUB(get_hv("Regexp::", GV_ADD), "DESTROY", NULL); + GV* const gv = gv_fetchpvs("Regexp::", GV_ADD, SVt_PVHV); + HV* const stash = GvHV(gv); + CV* const cv = + newCONSTSUB_flags(stash, "DESTROY", STRLENs("DESTROY"), 0, NULL); char ** cvfile = &CvFILE(cv); char * oldfile = *cvfile; CvDYNFILE_off(cv);