summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-08-08 20:06:11 +0100
committerZefram <zefram@fysh.org>2017-08-08 21:38:16 +0100
commita83b92fa8845fe243b594cefd53ec906a9de17a6 (patch)
tree94cebd94116c4f4eefb2a73e63ebc0fe62794552 /gv.c
parent71c697dea4f5a96ca9a9867eef07455c74f502f5 (diff)
downloadperl-a83b92fa8845fe243b594cefd53ec906a9de17a6.tar.gz
use cv_set_call_checker_flags() where possible
Call checkers established by core code were being set through cv_set_call_checker(), so requiring GVs to be created in some cases where they could be avoided. Make all the checkers non-GV-namegv capable, and set them with cv_set_call_checker_flags(). The checkers for Devel::Peek::Dump() and utf8::{unicode_to_native,native_to_unicode}() were already fit to handle non-GV names, so required no changes. The checker for CORE:: subs, ck_entersub_args_core(), was naughtily using the name to decide which sub it was dealing with in some cases, so move that information into the ckobj that was already being used to identify the sub in most cases. It also required reformulation of some error reporting code to use cv_name().
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gv.c b/gv.c
index 39782bcb5e..afddfe48a8 100644
--- a/gv.c
+++ b/gv.c
@@ -608,11 +608,12 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv,
PL_compcv = oldcompcv;
}
if (cv) {
- SV *opnumsv = opnum ? newSVuv((UV)opnum) : (SV *)NULL;
- cv_set_call_checker(
- cv, Perl_ck_entersub_args_core, opnumsv ? opnumsv : (SV *)cv
- );
- SvREFCNT_dec(opnumsv);
+ SV *opnumsv = newSViv(
+ (opnum == OP_ENTEREVAL && len == 9 && memEQ(name, "evalbytes", 9)) ?
+ (OP_ENTEREVAL | (1<<16))
+ : opnum ? opnum : (((I32)name[2]) << 16));
+ cv_set_call_checker_flags(cv, Perl_ck_entersub_args_core, opnumsv, 0);
+ SvREFCNT_dec_NN(opnumsv);
}
return gv;