summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2019-10-25 05:26:53 +1100
committerTony Cook <tony@develop-help.com>2019-10-30 20:09:37 +0100
commit9f601cf3bbfa6be3e2ab3468e77a7b79c80ff5cf (patch)
treecfb97c690e5e69e19f3e73fe532606008a1cd5ab /pp_ctl.c
parent698f6cc7d55bb6b96940a610be050d2c6331ae04 (diff)
downloadperl-9f601cf3bbfa6be3e2ab3468e77a7b79c80ff5cf.tar.gz
Faster feature checks
Perform only a bit check instead of a much more expensive hash lookup to test features. For now I've just added a U32 to the cop structure to store the bits, if we need more we could either add more bits directly, or make it a pointer. We don't have the immediate need for a pointer that warning do since we don't dynamically add new features during compilation/runtime. The changes to %^H are retained so that caller() can be used from perl code to check the features enabled at a given caller's scope.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 5bd9376b03..ec08078d2a 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -33,6 +33,7 @@
#include "EXTERN.h"
#define PERL_IN_PP_CTL_C
#include "perl.h"
+#include "feature.h"
#define RUN_PP_CATCHABLY(thispp) \
STMT_START { if (CATCH_GET) return docatch(thispp); } STMT_END
@@ -3485,6 +3486,7 @@ S_doeval_compile(pTHX_ U8 gimme, CV* outside, U32 seq, HV *hh)
if (clear_hints) {
PL_hints = 0;
hv_clear(GvHV(PL_hintgv));
+ CLEARFEATUREBITS();
}
else {
PL_hints = saveop->op_private & OPpEVAL_COPHH
@@ -3502,6 +3504,7 @@ S_doeval_compile(pTHX_ U8 gimme, CV* outside, U32 seq, HV *hh)
/* SAVEHINTS created a new HV in PL_hintgv, which we need to GC */
SvREFCNT_dec(GvHV(PL_hintgv));
GvHV(PL_hintgv) = hh;
+ FETCHFEATUREBITSHH(hh);
}
}
SAVECOMPILEWARNINGS();