In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/bdb0ae96bbbe0efcef6147fd6497bd49971334ed?hp=e3f7a67e8485950fdf5fd9c7131d0a78b6c8cf32>
- Log ----------------------------------------------------------------- commit bdb0ae96bbbe0efcef6147fd6497bd49971334ed Author: Father Chrysostomos <spr...@cpan.org> Date: Fri Aug 12 08:43:39 2016 -0700 scope.c: Appease C++ C++ is dumb. M scope.c commit ee33cc1af47fcf535fa762422a110c2782c45935 Author: Father Chrysostomos <spr...@cpan.org> Date: Fri Aug 12 08:37:37 2016 -0700 gv.c:require_tie_mod: Make var name a char param This reduces machine code size a little and simplifies require_tie_mod. On a non-debugging Linux GCC build with -O2: Before: $ ls -l gv.o -rw-r--r-- 1 sprout p5p 88704 Aug 12 07:29 gv.o After: $ ls -l gv.o -rw-r--r-- 1 sprout p5p 88656 Aug 12 17:29 gv.o M embed.fnc M gv.c M proto.h commit beb162121766004ac91b7bcb84a59a1402fe1634 Author: Father Chrysostomos <spr...@cpan.org> Date: Fri Aug 12 08:31:43 2016 -0700 perlcall: Remove redundant dSP call_argv does not use a stack pointer. This example has had the redundant dSP since perl 5.000, presumably due to copying and pasting from another example. M pod/perlcall.pod ----------------------------------------------------------------------- Summary of changes: embed.fnc | 2 +- gv.c | 19 ++++++++----------- pod/perlcall.pod | 2 -- proto.h | 4 ++-- scope.c | 6 ++++-- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/embed.fnc b/embed.fnc index 894a511..10f09cb 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1938,7 +1938,7 @@ s |bool|gv_magicalize|NN GV *gv|NN HV *stash|NN const char *name \ s |void|maybe_multimagic_gv|NN GV *gv|NN const char *name|const svtype sv_type s |bool|gv_is_in_main|NN const char *name|STRLEN len \ |const U32 is_utf8 -s |void |require_tie_mod|NN GV *gv|NN const char *varpv \ +s |void |require_tie_mod|NN GV *gv|NN const char varname \ |NN const char * name|STRLEN len \ |const U32 flags #endif diff --git a/gv.c b/gv.c index e24a193..1bc8bf2 100644 --- a/gv.c +++ b/gv.c @@ -1298,19 +1298,16 @@ Perl_gv_autoload_pvn(pTHX_ HV *stash, const char *name, STRLEN len, U32 flags) * with the passed gv as an argument. * * The "gv" parameter should be the glob. - * "varpv" holds the name of the var, used for error messages. + * "varname" holds the 1-char name of the var, used for error messages. * "namesv" holds the module name. Its refcount will be decremented. * "flags": if flag & 1 then save the scalar before loading. * For the protection of $! to work (it is set by this routine) * the sv slot must already be magicalized. */ STATIC void -S_require_tie_mod(pTHX_ GV *gv, const char *varpv, const char * name, +S_require_tie_mod(pTHX_ GV *gv, const char varname, const char * name, STRLEN len, const U32 flags) { - const char varname = *varpv; /* varpv might be clobbered by - load_module, so save it. For the - moment itâs always a single char. */ const SV * const target = varname == '[' ? GvSV(gv) : (SV *)GvHV(gv); PERL_ARGS_ASSERT_REQUIRE_TIE_MOD; @@ -2080,7 +2077,7 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, /* magicalization must be done before require_tie_mod is called */ if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) - require_tie_mod(gv, "!", "Errno", 5, 1); + require_tie_mod(gv, '!', "Errno", 5, 1); break; case '-': /* $- */ @@ -2097,7 +2094,7 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, SvREADONLY_on(av); if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) - require_tie_mod(gv, name, "Tie::Hash::NamedCapture",23, 0); + require_tie_mod(gv, *name, "Tie::Hash::NamedCapture",23,0); break; } @@ -2117,7 +2114,7 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, case '[': /* $[ */ if ((sv_type == SVt_PV || sv_type == SVt_PVGV) && FEATURE_ARYBASE_IS_ENABLED) { - require_tie_mod(gv,name,"arybase",7,0); + require_tie_mod(gv,'[',"arybase",7,0); } else goto magicalize; break; @@ -2211,9 +2208,9 @@ S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type) if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) { if (*name == '!') - require_tie_mod(gv, "!", "Errno", 5, 1); + require_tie_mod(gv, '!', "Errno", 5, 1); else if (*name == '-' || *name == '+') - require_tie_mod(gv, name, "Tie::Hash::NamedCapture", 23, 0); + require_tie_mod(gv, *name, "Tie::Hash::NamedCapture", 23, 0); } else if (sv_type == SVt_PV) { if (*name == '*' || *name == '#') { /* diag_listed_as: $* is no longer supported */ @@ -2225,7 +2222,7 @@ S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type) if (sv_type==SVt_PV || sv_type==SVt_PVGV) { switch (*name) { case '[': - require_tie_mod(gv,name,"arybase",7,0); + require_tie_mod(gv,'[',"arybase",7,0); break; #ifdef PERL_SAWAMPERSAND case '`': diff --git a/pod/perlcall.pod b/pod/perlcall.pod index c41d835..9a268aa 100644 --- a/pod/perlcall.pod +++ b/pod/perlcall.pod @@ -1223,8 +1223,6 @@ I<PrintList>. static void call_PrintList() { - dSP; - call_argv("PrintList", G_DISCARD, words); } diff --git a/proto.h b/proto.h index f047e46..6c0d166 100644 --- a/proto.h +++ b/proto.h @@ -4324,9 +4324,9 @@ STATIC void S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype s STATIC bool S_parse_gv_stash_name(pTHX_ HV **stash, GV **gv, const char **name, STRLEN *len, const char *nambeg, STRLEN full_len, const U32 is_utf8, const I32 add); #define PERL_ARGS_ASSERT_PARSE_GV_STASH_NAME \ assert(stash); assert(gv); assert(name); assert(len); assert(nambeg) -STATIC void S_require_tie_mod(pTHX_ GV *gv, const char *varpv, const char * name, STRLEN len, const U32 flags); +STATIC void S_require_tie_mod(pTHX_ GV *gv, const char varname, const char * name, STRLEN len, const U32 flags); #define PERL_ARGS_ASSERT_REQUIRE_TIE_MOD \ - assert(gv); assert(varpv); assert(name) + assert(gv); assert(varname); assert(name) #endif #if defined(PERL_IN_GV_C) || defined(PERL_IN_SV_C) || defined(PERL_IN_PAD_C) || defined(PERL_IN_OP_C) PERL_CALLCONV void Perl_sv_add_backref(pTHX_ SV *const tsv, SV *const sv); diff --git a/scope.c b/scope.c index d78857b..ff84e64 100644 --- a/scope.c +++ b/scope.c @@ -1116,8 +1116,10 @@ Perl_leave_scope(pTHX_ I32 base) case SAVEt_CLEARPADRANGE: { - I32 i = (I32)((uv >> SAVE_TIGHT_SHIFT) & OPpPADRANGE_COUNTMASK); - SV **svp = &PL_curpad[uv >> + I32 i; + SV **svp; + i = (I32)((uv >> SAVE_TIGHT_SHIFT) & OPpPADRANGE_COUNTMASK); + svp = &PL_curpad[uv >> (OPpPADRANGE_COUNTSHIFT + SAVE_TIGHT_SHIFT)] + i - 1; goto clearsv; case SAVEt_CLEARSV: -- Perl5 Master Repository