Skip to content

Commit 1b1d43b

Browse files
committed
remove unused arg in gv_fetchfile_flags
Since gv_fetchfile_flags was created in commit d9095ce in 5.9.5 in 2007 the flags argument has been unused and undefined as to its meaning. Remove the cpu instruction overhead of pushing the flags arg in the callers of gv_fetchfile_flags by changing it to a macro that drops out the flags argument. Only known callers are NYTProf and core's gv_fetchfile according to cpan grep. This commits sets up future refactoring of gv_fetchfile*.
1 parent 52ffb1b commit 1b1d43b

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

embed.fnc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,9 @@ Ap |void |gv_efullname |NN SV* sv|NN const GV* gv
505505
Apmb |void |gv_efullname3 |NN SV* sv|NN const GV* gv|NULLOK const char* prefix
506506
Ap |void |gv_efullname4 |NN SV* sv|NN const GV* gv|NULLOK const char* prefix|bool keepmain
507507
Ap |GV* |gv_fetchfile |NN const char* name
508-
Ap |GV* |gv_fetchfile_flags|NN const char *const name|const STRLEN len\
508+
Am |GV* |gv_fetchfile_flags|NN const char *const name|const STRLEN len\
509509
|const U32 flags
510+
pX |GV* |gv_fetchfile_x|NN const char *const name|const STRLEN len
510511
Amd |GV* |gv_fetchmeth |NULLOK HV* stash|NN const char* name \
511512
|STRLEN len|I32 level
512513
Apd |GV* |gv_fetchmeth_sv |NULLOK HV* stash|NN SV* namesv|I32 level|U32 flags

embed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@
193193
#define gv_efullname(a,b) Perl_gv_efullname(aTHX_ a,b)
194194
#define gv_efullname4(a,b,c,d) Perl_gv_efullname4(aTHX_ a,b,c,d)
195195
#define gv_fetchfile(a) Perl_gv_fetchfile(aTHX_ a)
196-
#define gv_fetchfile_flags(a,b,c) Perl_gv_fetchfile_flags(aTHX_ a,b,c)
197196
#define gv_fetchmeth_pv(a,b,c,d) Perl_gv_fetchmeth_pv(aTHX_ a,b,c,d)
198197
#define gv_fetchmeth_pv_autoload(a,b,c,d) Perl_gv_fetchmeth_pv_autoload(aTHX_ a,b,c,d)
199198
#define gv_fetchmeth_pvn(a,b,c,d,e) Perl_gv_fetchmeth_pvn(aTHX_ a,b,c,d,e)
@@ -1221,6 +1220,7 @@
12211220
#define get_hash_seed(a) Perl_get_hash_seed(aTHX_ a)
12221221
#define get_no_modify() Perl_get_no_modify(aTHX)
12231222
#define get_opargs() Perl_get_opargs(aTHX)
1223+
#define gv_fetchfile_x(a,b) Perl_gv_fetchfile_x(aTHX_ a,b)
12241224
#define gv_override(a,b) Perl_gv_override(aTHX_ a,b)
12251225
#define gv_setref(a,b) Perl_gv_setref(aTHX_ a,b)
12261226
#define gv_try_downgrade(a) Perl_gv_try_downgrade(aTHX_ a)

gv.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,14 @@ Perl_gv_fetchfile(pTHX_ const char *name)
9898
}
9999

100100
GV *
101-
Perl_gv_fetchfile_flags(pTHX_ const char *const name, const STRLEN namelen,
102-
const U32 flags)
101+
Perl_gv_fetchfile_x(pTHX_ const char *const name, const STRLEN namelen)
103102
{
104103
char smallbuf[128];
105104
char *tmpbuf;
106105
const STRLEN tmplen = namelen + 2;
107106
GV *gv;
108107

109-
PERL_ARGS_ASSERT_GV_FETCHFILE_FLAGS;
110-
PERL_UNUSED_ARG(flags);
108+
PERL_ARGS_ASSERT_GV_FETCHFILE_X;
111109

112110
if (!PL_defstash)
113111
return NULL;

gv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ Return the CV from the GV.
265265
#define gv_fetchmeth(stash,name,len,level) gv_fetchmeth_pvn(stash, name, len, level, 0)
266266
#define gv_fetchmeth_autoload(stash,name,len,level) gv_fetchmeth_pvn_autoload(stash, name, len, level, 0)
267267
#define gv_fetchmethod_flags(stash,name,flags) gv_fetchmethod_pv_flags(stash, name, flags)
268+
#define gv_fetchfile_flags(name,len,flags) Perl_gv_fetchfile_x(aTHX_ name,len)
268269
#define gv_autoload4(stash, name, len, method) \
269270
gv_autoload_pvn(stash, name, len, !!(method))
270271
#define newGVgen(pack) newGVgen_flags(pack, 0)

proto.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,9 @@ PERL_CALLCONV void Perl_gv_efullname4(pTHX_ SV* sv, const GV* gv, const char* pr
10181018
PERL_CALLCONV GV* Perl_gv_fetchfile(pTHX_ const char* name);
10191019
#define PERL_ARGS_ASSERT_GV_FETCHFILE \
10201020
assert(name)
1021-
PERL_CALLCONV GV* Perl_gv_fetchfile_flags(pTHX_ const char *const name, const STRLEN len, const U32 flags);
1022-
#define PERL_ARGS_ASSERT_GV_FETCHFILE_FLAGS \
1021+
/* PERL_CALLCONV GV* gv_fetchfile_flags(pTHX_ const char *const name, const STRLEN len, const U32 flags); */
1022+
PERL_CALLCONV GV* Perl_gv_fetchfile_x(pTHX_ const char *const name, const STRLEN len);
1023+
#define PERL_ARGS_ASSERT_GV_FETCHFILE_X \
10231024
assert(name)
10241025
/* PERL_CALLCONV GV* gv_fetchmeth(pTHX_ HV* stash, const char* name, STRLEN len, I32 level); */
10251026
/* PERL_CALLCONV GV* gv_fetchmeth_autoload(pTHX_ HV* stash, const char* name, STRLEN len, I32 level); */

0 commit comments

Comments
 (0)