Skip to content

Commit b7a7434

Browse files
committed
mathoms.c Remove functions that just call their macro
The long name Perl_foo functions that merely call their implementing macro 'foo', can themselves just be #defined as that macro instead of being functions. Since 93f23f0, it is now easy to make them into macros by specifying the appropriate flags in embed.fnc. So the mathoms.c function implementations can be removed, and regen/embed.pl will generate the equivalent macro definitions.
1 parent a3bd1cd commit b7a7434

File tree

4 files changed

+88
-164
lines changed

4 files changed

+88
-164
lines changed

embed.fnc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ ARdp |GV * |gv_autoload_pvn|NULLOK NOCHECK HV *stash \
13251325
ARdp |GV * |gv_autoload_sv |NULLOK NOCHECK HV *stash \
13261326
|NN SV *namesv \
13271327
|U32 flags
1328-
AMbdp |GV * |gv_AVadd |NULLOK GV *gv
1328+
Admp |GV * |gv_AVadd |NULLOK GV *gv
13291329
Cp |void |gv_check |NN HV *stash
13301330
: Used in pp.c and pp_sys.c
13311331
ARdp |SV * |gv_const_sv |NN GV *gv
@@ -1421,7 +1421,7 @@ Adp |void |gv_fullname4 |NN SV *sv \
14211421
|bool keepmain
14221422
CRdp |CV * |gv_handler |NULLOK HV *stash \
14231423
|I32 id
1424-
AMbdp |GV * |gv_HVadd |NULLOK GV *gv
1424+
Admp |GV * |gv_HVadd |NULLOK GV *gv
14251425
Adm |void |gv_init |NN GV *gv \
14261426
|NULLOK HV *stash \
14271427
|NN const char *name \
@@ -2313,7 +2313,7 @@ ARdp |SV * |newSVpvz |const STRLEN len
23132313
ARdp |OP * |newSVREF |NN OP *o
23142314
Adp |SV * |newSVrv |NN SV * const rv \
23152315
|NULLOK const char * const classname
2316-
AMRbdp |SV * |newSVsv |NULLOK SV * const old
2316+
ARdmp |SV * |newSVsv |NULLOK SV * const old
23172317
ARdp |SV * |newSVsv_flags |NULLOK SV * const old \
23182318
|I32 flags
23192319
ARdm |SV * |newSVsv_nomg |NULLOK SV * const old
@@ -2913,10 +2913,10 @@ Cp |void |save_destructor_x \
29132913
|DESTRUCTORFUNC_t f \
29142914
|NULLOK void *p
29152915
: Used in SAVEFREOP(), used in op.c, pp_ctl.c
2916-
CMbp |void |save_freeop |NULLOK OP *o
2917-
CMbp |void |save_freepv |NULLOK char *pv
2916+
Cmp |void |save_freeop |NULLOK OP *o
2917+
Cmp |void |save_freepv |NULLOK char *pv
29182918
Cdp |void |save_freercpv |NN char *rcpv
2919-
CMbp |void |save_freesv |NULLOK SV *sv
2919+
Cmp |void |save_freesv |NULLOK SV *sv
29202920
Cdp |void |save_generic_pvref \
29212921
|NN char **str
29222922
Cdp |void |save_generic_svref \
@@ -2942,10 +2942,10 @@ Cp |void |save_I8 |NN I8 *bytep
29422942
Cp |void |save_int |NN int *intp
29432943
Adhp |void |save_item |NN SV *item
29442944
Cp |void |save_iv |NN IV *ivp
2945-
CMbp |void |save_mortalizesv \
2945+
Cmp |void |save_mortalizesv \
29462946
|NN SV *sv
29472947
: Used in SAVEFREOP(), used in gv.c, op.c, perl.c, pp_ctl.c, pp_sort.c
2948-
CMbdp |void |save_op
2948+
Cdmp |void |save_op
29492949
Cdp |void |save_padsv_and_mortalize \
29502950
|PADOFFSET off
29512951
Cp |void |save_pptr |NN char **pptr
@@ -3309,9 +3309,9 @@ Adp |STRLEN |sv_pos_u2b_flags \
33093309
AMbdp |char * |sv_2pv |NN SV *sv \
33103310
|NULLOK STRLEN *lp
33113311
CMRbdp |char * |sv_pv |NN SV *sv
3312-
AMbdp |char * |sv_2pvbyte |NN SV *sv \
3312+
Admp |char * |sv_2pvbyte |NN SV *sv \
33133313
|NULLOK STRLEN * const lp
3314-
CMRbdp |char * |sv_pvbyte |NN SV *sv
3314+
CMRdp |char * |sv_pvbyte |NN SV *sv
33153315
Adp |char * |sv_2pvbyte_flags \
33163316
|NN SV *sv \
33173317
|NULLOK STRLEN * const lp \
@@ -3335,7 +3335,7 @@ Adp |char * |sv_pvn_force_flags \
33353335
|NULLOK STRLEN * const lp \
33363336
|const U32 flags
33373337
CMRbdp |char * |sv_2pv_nolen |NN SV *sv
3338-
AMbdp |char * |sv_2pvutf8 |NN SV *sv \
3338+
Admp |char * |sv_2pvutf8 |NN SV *sv \
33393339
|NULLOK STRLEN * const lp
33403340
CMRbdp |char * |sv_pvutf8 |NN SV *sv
33413341
Adp |char * |sv_2pvutf8_flags \
@@ -3521,7 +3521,7 @@ AMbdp |void |sv_usepvn_mg |NN SV *sv \
35213521
|NULLOK char *ptr \
35223522
|STRLEN len
35233523
Adp |bool |sv_utf8_decode |NN SV * const sv
3524-
AMbdp |bool |sv_utf8_downgrade \
3524+
Admp |bool |sv_utf8_downgrade \
35253525
|NN SV * const sv \
35263526
|const bool fail_ok
35273527
Adp |bool |sv_utf8_downgrade_flags \
@@ -4182,7 +4182,7 @@ Mp |bool |do_exec |NN const char *cmd
41824182
p |bool |do_exec |NN const char *cmd
41834183
#endif
41844184
#if defined(PERL_DONT_CREATE_GVSV)
4185-
AMbdp |GV * |gv_SVadd |NULLOK GV *gv
4185+
Admp |GV * |gv_SVadd |NULLOK GV *gv
41864186
#endif
41874187
#if defined(PERL_IMPLICIT_SYS)
41884188
CTo |PerlInterpreter *|perl_alloc_using \

embed.h

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,12 +2258,40 @@
22582258
# define PerlIO_write(a,b,c) Perl_PerlIO_write(aTHX_ a,b,c)
22592259
# endif /* defined(USE_PERLIO) */
22602260
# if defined(USE_THREADS)
2261+
# define Perl_gv_AVadd(mTHX,a) gv_AVadd(a)
2262+
# define Perl_gv_HVadd(mTHX,a) gv_HVadd(a)
2263+
# define Perl_newSVsv(mTHX,a) newSVsv(a)
2264+
# define Perl_save_freeop(mTHX,a) save_freeop(a)
2265+
# define Perl_save_freepv(mTHX,a) save_freepv(a)
2266+
# define Perl_save_freesv(mTHX,a) save_freesv(a)
2267+
# define Perl_save_mortalizesv(mTHX,a) save_mortalizesv(a)
2268+
# define Perl_save_op(mTHX) save_op()
2269+
# define Perl_sv_2pvbyte(mTHX,a,b) sv_2pvbyte(a,b)
2270+
# define Perl_sv_2pvutf8(mTHX,a,b) sv_2pvutf8(a,b)
2271+
# define Perl_sv_utf8_downgrade(mTHX,a,b) sv_utf8_downgrade(a,b)
22612272
# define Perl_uv_to_utf8_msgs(mTHX,a,b,c,d) uv_to_utf8_msgs(a,b,c,d)
22622273
# define thread_locale_init() Perl_thread_locale_init(aTHX)
22632274
# define thread_locale_term() Perl_thread_locale_term(aTHX)
2264-
# else
2275+
# if defined(PERL_DONT_CREATE_GVSV)
2276+
# define Perl_gv_SVadd(mTHX,a) gv_SVadd(a)
2277+
# endif
2278+
# else /* if !defined(USE_THREADS) */
2279+
# define Perl_gv_AVadd gv_AVadd
2280+
# define Perl_gv_HVadd gv_HVadd
2281+
# define Perl_newSVsv newSVsv
2282+
# define Perl_save_freeop save_freeop
2283+
# define Perl_save_freepv save_freepv
2284+
# define Perl_save_freesv save_freesv
2285+
# define Perl_save_mortalizesv save_mortalizesv
2286+
# define Perl_save_op save_op
2287+
# define Perl_sv_2pvbyte sv_2pvbyte
2288+
# define Perl_sv_2pvutf8 sv_2pvutf8
2289+
# define Perl_sv_utf8_downgrade sv_utf8_downgrade
22652290
# define Perl_uv_to_utf8_msgs uv_to_utf8_msgs
2266-
# endif
2291+
# if defined(PERL_DONT_CREATE_GVSV)
2292+
# define Perl_gv_SVadd gv_SVadd
2293+
# endif
2294+
# endif /* !defined(USE_THREADS) */
22672295
# if defined(VMS) || defined(WIN32)
22682296
# define do_aspawn(a,b,c) Perl_do_aspawn(aTHX_ a,b,c)
22692297
# define do_spawn(a) Perl_do_spawn(aTHX_ a)

mathoms.c

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -578,64 +578,6 @@ Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len,
578578
sv_insert_flags(bigstr, offset, len, little, littlelen, SV_GMAGIC);
579579
}
580580

581-
void
582-
Perl_save_freesv(pTHX_ SV *sv)
583-
{
584-
save_freesv(sv);
585-
}
586-
587-
void
588-
Perl_save_mortalizesv(pTHX_ SV *sv)
589-
{
590-
PERL_ARGS_ASSERT_SAVE_MORTALIZESV;
591-
592-
save_mortalizesv(sv);
593-
}
594-
595-
void
596-
Perl_save_freeop(pTHX_ OP *o)
597-
{
598-
save_freeop(o);
599-
}
600-
601-
void
602-
Perl_save_freepv(pTHX_ char *pv)
603-
{
604-
save_freepv(pv);
605-
}
606-
607-
void
608-
Perl_save_op(pTHX)
609-
{
610-
save_op();
611-
}
612-
613-
#ifdef PERL_DONT_CREATE_GVSV
614-
GV *
615-
Perl_gv_SVadd(pTHX_ GV *gv)
616-
{
617-
return gv_SVadd(gv);
618-
}
619-
#endif
620-
621-
GV *
622-
Perl_gv_AVadd(pTHX_ GV *gv)
623-
{
624-
return gv_AVadd(gv);
625-
}
626-
627-
GV *
628-
Perl_gv_HVadd(pTHX_ GV *gv)
629-
{
630-
return gv_HVadd(gv);
631-
}
632-
633-
GV *
634-
Perl_gv_IOadd(pTHX_ GV *gv)
635-
{
636-
return gv_IOadd(gv);
637-
}
638-
639581
IO *
640582
Perl_newIO(pTHX)
641583
{
@@ -742,36 +684,6 @@ Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen)
742684
return NATIVE_TO_UNI(valid_utf8_to_uvchr(s, retlen));
743685
}
744686

745-
SV *
746-
Perl_newSVsv(pTHX_ SV *const old)
747-
{
748-
return newSVsv(old);
749-
}
750-
751-
bool
752-
Perl_sv_utf8_downgrade(pTHX_ SV *const sv, const bool fail_ok)
753-
{
754-
PERL_ARGS_ASSERT_SV_UTF8_DOWNGRADE;
755-
756-
return sv_utf8_downgrade(sv, fail_ok);
757-
}
758-
759-
char *
760-
Perl_sv_2pvutf8(pTHX_ SV *sv, STRLEN *const lp)
761-
{
762-
PERL_ARGS_ASSERT_SV_2PVUTF8;
763-
764-
return sv_2pvutf8(sv, lp);
765-
}
766-
767-
char *
768-
Perl_sv_2pvbyte(pTHX_ SV *sv, STRLEN *const lp)
769-
{
770-
PERL_ARGS_ASSERT_SV_2PVBYTE;
771-
772-
return sv_2pvbyte(sv, lp);
773-
}
774-
775687
U8 *
776688
Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
777689
{

0 commit comments

Comments
 (0)