diff options
author | David Mitchell <davem@iabyn.com> | 2015-12-30 15:20:41 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-02-03 09:19:20 +0000 |
commit | 7950309912fb5e5c8492d238ac32a179e0deaa6f (patch) | |
tree | 25b1bf2a01ca6a4d8b4fab029ccf90e9174df383 | |
parent | 2a7b7c61f9476ae461c8590ca7e251e214462420 (diff) | |
download | perl-7950309912fb5e5c8492d238ac32a179e0deaa6f.tar.gz |
dMULTICALL: remove unused vars
dMULTICALL declares several vars that are used either to maintain
state across multiple calls, or to pass values to PUSHSUB etc, where
those macros expected to obtain some of their args by values being
implicitly passed via local vars. Since PUSHSUB has been replaced by
cx_pushsub() which now has all parameters explicitly passed, there is
no longer any need for those vars. So this commit eliminates them:
newsp
hasargs
There are also a couple vars which are no longer used due to changes to
the implementation over time; these can also be eliminated:
cx multicall_cv
Finally, this branch introduced a new var, saveix_floor; rename it to
multicall_saveix_floor for consistency with other dMULTICALL vars.
Although none of these vars are listed in the documentation, its possible
that some code out there may rely on them in some way, and will need to be
fixed up.
-rw-r--r-- | cop.h | 26 | ||||
-rw-r--r-- | ext/XS-APItest/APItest.xs | 3 | ||||
-rw-r--r-- | regexec.c | 10 |
3 files changed, 12 insertions, 27 deletions
@@ -1081,13 +1081,9 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>. */ #define dMULTICALL \ - SV **newsp; /* set by cx_popblock */ \ - PERL_CONTEXT *cx; \ - CV *multicall_cv; \ - OP *multicall_cop; \ + OP *multicall_cop; \ bool multicall_oldcatch; \ - I32 saveix_floor; \ - U8 hasargs = 0 /* used by CX_PUSHSUB */ + I32 multicall_saveix_floor #define PUSH_MULTICALL(the_cv) \ PUSH_MULTICALL_FLAGS(the_cv, 0) @@ -1097,6 +1093,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>. #define PUSH_MULTICALL_FLAGS(the_cv, flags) \ STMT_START { \ + PERL_CONTEXT *cx; \ CV * const _nOnclAshIngNamE_ = the_cv; \ CV * const cv = _nOnclAshIngNamE_; \ PADLIST * const padlist = CvPADLIST(cv); \ @@ -1105,16 +1102,14 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>. PUSHSTACKi(PERLSI_MULTICALL); \ cx = cx_pushblock((CXt_SUB|CXp_MULTICALL|flags), gimme, \ PL_stack_sp, PL_savestack_ix); \ - cx_pushsub(cx, cv, NULL, cBOOL(hasargs)); \ + cx_pushsub(cx, cv, NULL, 0); \ SAVEOP(); \ - saveix_floor = PL_savestack_ix; \ + multicall_saveix_floor = PL_savestack_ix; \ if (!(flags & CXp_SUB_RE_FAKE)) \ CvDEPTH(cv)++; \ if (CvDEPTH(cv) >= 2) \ Perl_pad_push(aTHX_ padlist, CvDEPTH(cv)); \ PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); \ - multicall_cv = cv; \ - PERL_UNUSED_VAR(multicall_cv); /* for API */ \ multicall_cop = CvSTART(cv); \ } STMT_END @@ -1122,18 +1117,16 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>. STMT_START { \ PL_op = multicall_cop; \ CALLRUNOPS(aTHX); \ - cx = CX_CUR(); \ - LEAVE_SCOPE(saveix_floor); \ + LEAVE_SCOPE(multicall_saveix_floor); \ } STMT_END #define POP_MULTICALL \ STMT_START { \ + PERL_CONTEXT *cx; \ cx = CX_CUR(); \ CX_LEAVE_SCOPE(cx); \ cx_popsub_common(cx); \ - newsp = PL_stack_base + cx->blk_oldsp; \ gimme = cx->blk_gimme; \ - PERL_UNUSED_VAR(newsp); /* for API */ \ PERL_UNUSED_VAR(gimme); /* for API */ \ cx_popblock(cx); \ CX_POP(cx); \ @@ -1150,17 +1143,16 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>. CV * const _nOnclAshIngNamE_ = the_cv; \ CV * const cv = _nOnclAshIngNamE_; \ PADLIST * const padlist = CvPADLIST(cv); \ - cx = CX_CUR(); \ + PERL_CONTEXT *cx = CX_CUR(); \ assert(CxMULTICALL(cx)); \ cx_popsub_common(cx); \ cx->cx_type = (CXt_SUB|CXp_MULTICALL|flags); \ - cx_pushsub(cx, cv, NULL, cBOOL(hasargs)); \ + cx_pushsub(cx, cv, NULL, 0); \ if (!(flags & CXp_SUB_RE_FAKE)) \ CvDEPTH(cv)++; \ if (CvDEPTH(cv) >= 2) \ Perl_pad_push(aTHX_ padlist, CvDEPTH(cv)); \ PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); \ - multicall_cv = cv; \ multicall_cop = CvSTART(cv); \ } STMT_END /* diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index 3e2d071068..d7376ba21e 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -3640,7 +3640,6 @@ CODE: MULTICALL; } POP_MULTICALL; - PERL_UNUSED_VAR(newsp); XSRETURN_UNDEF; } @@ -3698,8 +3697,6 @@ CODE: POP_MULTICALL; - PERL_UNUSED_VAR(newsp); - size = AvFILLp(av) + 1; EXTEND(SP, size); for (i = 0; i < size; i++) @@ -5197,11 +5197,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog) /* shut up 'may be used uninitialized' compiler warnings for dMULTICALL */ multicall_oldcatch = 0; - multicall_cv = NULL; - cx = NULL; PERL_UNUSED_VAR(multicall_cop); - PERL_UNUSED_VAR(newsp); - PERL_ARGS_ASSERT_REGMATCH; @@ -6608,7 +6604,6 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog) /* these assignments are just to silence compiler * warnings */ multicall_cop = NULL; - newsp = NULL; } last_pad = PL_comppad; @@ -6660,11 +6655,12 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog) /* we don't use MULTICALL here as we want to call the * first op of the block of interest, rather than the - * first op of the sub */ + * first op of the sub. Also, we don't want to free + * the savestack frame */ before = (IV)(SP-PL_stack_base); PL_op = nop; CALLRUNOPS(aTHX); /* Scalar context. */ - PERL_UNUSED_VAR(saveix_floor); /* used by MULTICALL */ + PERL_UNUSED_VAR(multicall_saveix_floor); /* used by MULTICALL */ SPAGAIN; if ((IV)(SP-PL_stack_base) == before) ret = &PL_sv_undef; /* protect against empty (?{}) blocks. */ |