summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2006-02-24 08:54:35 -0600
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-02-27 11:06:30 +0000
commitb37c2d43c8bccbefe3985273e9661833102148d0 (patch)
treeb996c0398e5f83c4ed03e0b1144f10819ba27a27 /pp_ctl.c
parentee94f8101362ee382e42ec2d404d79b0ab7d17ef (diff)
downloadperl-b37c2d43c8bccbefe3985273e9661833102148d0.tar.gz
Speedups and shrinkages of SvREFCNT_inc
Message-ID: <20060224205434.GA17867@petdance.com> p4raw-id: //depot/perl@27334
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 8d20d6f262..ffc80c8e43 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2317,7 +2317,7 @@ PP(pp_goto)
}
/* First do some returnish stuff. */
- (void)SvREFCNT_inc(cv); /* avoid premature free during unwind */
+ SvREFCNT_inc_simple_void(cv); /* avoid premature free during unwind */
FREETMPS;
cxix = dopoptosub(cxstack_ix);
if (cxix < 0)
@@ -2373,7 +2373,7 @@ PP(pp_goto)
SAVETMPS;
SAVEFREESV(cv); /* later, undo the 'avoid premature free' hack */
if (CvISXSUB(cv)) {
- OP* retop = cx->blk_sub.retop;
+ OP* const retop = cx->blk_sub.retop;
SV **newsp;
I32 gimme;
if (reified) {
@@ -2382,20 +2382,17 @@ PP(pp_goto)
sv_2mortal(SP[-index]);
}
- /* XS subs don't have a CxSUB, so pop it */
- POPBLOCK(cx, PL_curpm);
- /* Push a mark for the start of arglist */
- PUSHMARK(mark);
- PUTBACK;
- (void)(*CvXSUB(cv))(aTHX_ cv);
- /* Put these at the bottom since the vars are set but not used */
- PERL_UNUSED_VAR(newsp);
- PERL_UNUSED_VAR(gimme);
+ /* XS subs don't have a CxSUB, so pop it */
+ POPBLOCK(cx, PL_curpm);
+ /* Push a mark for the start of arglist */
+ PUSHMARK(mark);
+ PUTBACK;
+ (void)(*CvXSUB(cv))(aTHX_ cv);
LEAVE;
return retop;
}
else {
- AV* padlist = CvPADLIST(cv);
+ AV* const padlist = CvPADLIST(cv);
if (CxTYPE(cx) == CXt_EVAL) {
PL_in_eval = cx->blk_eval.old_in_eval;
PL_eval_root = cx->blk_eval.old_eval_root;
@@ -2407,7 +2404,7 @@ PP(pp_goto)
CvDEPTH(cv)++;
if (CvDEPTH(cv) < 2)
- (void)SvREFCNT_inc(cv);
+ SvREFCNT_inc_void_NN(cv);
else {
if (CvDEPTH(cv) == 100 && ckWARN(WARN_RECURSION))
sub_crush_depth(cv);
@@ -2417,16 +2414,15 @@ PP(pp_goto)
PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv));
if (cx->blk_sub.hasargs)
{
- AV* av = (AV*)PAD_SVl(0);
- SV** ary;
+ AV* const av = (AV*)PAD_SVl(0);
cx->blk_sub.savearray = GvAV(PL_defgv);
- GvAV(PL_defgv) = (AV*)SvREFCNT_inc(av);
+ GvAV(PL_defgv) = (AV*)SvREFCNT_inc_simple(av);
CX_CURPAD_SAVE(cx->blk_sub);
cx->blk_sub.argarray = av;
if (items >= AvMAX(av) + 1) {
- ary = AvALLOC(av);
+ SV **ary = AvALLOC(av);
if (AvARRAY(av) != ary) {
AvMAX(av) += AvARRAY(av) - AvALLOC(av);
SvPV_set(av, (char*)ary);
@@ -2459,8 +2455,6 @@ PP(pp_goto)
* it's for informational purposes only.
*/
SV * const sv = GvSV(PL_DBsub);
- CV *gotocv;
-
save_item(sv);
if (PERLDB_SUB_NN) {
const int type = SvTYPE(sv);
@@ -2471,11 +2465,13 @@ PP(pp_goto)
} else {
gv_efullname3(sv, CvGV(cv), NULL);
}
- if ( PERLDB_GOTO
- && (gotocv = get_cv("DB::goto", FALSE)) ) {
- PUSHMARK( PL_stack_sp );
- call_sv((SV*)gotocv, G_SCALAR | G_NODEBUG);
- PL_stack_sp--;
+ if (PERLDB_GOTO) {
+ CV * const gotocv = get_cv("DB::goto", FALSE);
+ if (gotocv) {
+ PUSHMARK( PL_stack_sp );
+ call_sv((SV*)gotocv, G_SCALAR | G_NODEBUG);
+ PL_stack_sp--;
+ }
}
}
RETURNOP(CvSTART(cv));
@@ -2800,7 +2796,7 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
(*startop)->op_ppaddr = PL_ppaddr[OP_NULL];
lex_end();
/* XXX DAPM do this properly one year */
- *padp = (AV*)SvREFCNT_inc(PL_comppad);
+ *padp = (AV*)SvREFCNT_inc_simple(PL_comppad);
LEAVE;
if (IN_PERL_COMPILETIME)
PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
@@ -2882,7 +2878,7 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq)
cxstack[cxstack_ix].blk_eval.cv = PL_compcv;
CvOUTSIDE_SEQ(PL_compcv) = seq;
- CvOUTSIDE(PL_compcv) = (CV*)SvREFCNT_inc(outside);
+ CvOUTSIDE(PL_compcv) = (CV*)SvREFCNT_inc_simple(outside);
/* set up a scratch pad */
@@ -3189,7 +3185,7 @@ PP(pp_require)
save the gv to manage the lifespan of
the pipe, but this didn't help. XXX */
filter_child_proc = (GV *)arg;
- (void)SvREFCNT_inc(filter_child_proc);
+ SvREFCNT_inc_simple_void(filter_child_proc);
}
else {
if (IoOFP(io) && IoOFP(io) != IoIFP(io)) {
@@ -3207,11 +3203,11 @@ PP(pp_require)
if (SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVCV) {
filter_sub = arg;
- (void)SvREFCNT_inc(filter_sub);
+ SvREFCNT_inc_void_NN(filter_sub);
if (i < count) {
filter_state = SP[i];
- (void)SvREFCNT_inc(filter_state);
+ SvREFCNT_inc_simple_void(filter_state);
}
if (!tryrsfp) {
@@ -3346,7 +3342,7 @@ PP(pp_require)
} else {
SV** const svp = hv_fetch(GvHVn(PL_incgv), name, len, 0);
if (!svp)
- (void)hv_store(GvHVn(PL_incgv), name, len, SvREFCNT_inc(hook_sv), 0 );
+ (void)hv_store(GvHVn(PL_incgv), name, len, SvREFCNT_inc_simple(hook_sv), 0 );
}
ENTER;