summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-10-04 13:28:58 +0200
committerFather Chrysostomos <sprout@cpan.org>2013-11-22 21:20:37 -0800
commitea35f80112fbe2dfbe7bc30c9804d106145e5241 (patch)
treeab80c56e3208406fd9a36945eabc1bd4196c324c /gv.c
parent865e3ae09bd2dde9953a008963d3c5a0ad14e32d (diff)
downloadperl-ea35f80112fbe2dfbe7bc30c9804d106145e5241.tar.gz
Remove redundant SPAGAIN & PUTBACK after PUSHSTACKi().
PUSHSTACKi() calls SWITCHSTACK(), which sets PL_stack_sp and sp like this: sp = PL_stack_sp = PL_stack_base + AvFILLp(t) Hence after PUSHSTACKi() both are identical, so use of SPAGAIN or PUTBACK to assign one to the other is redundant. The use of SPAGAIN in encoding.xs and via.xs was added with commit 24f59afc531955e5 (April 2002) which added the use of PUSHSTACKi(). It feels like cargo-cult. The use of PUTBACK in Perl_amagic_call() predates the introduction of nested stacks and PUSHSTACKi() in commit e336de0d01f30cc4 (April 1998). It dates from perl 5.000, but it's not clear that it was ever needed, as the code in question looked like this, and nothing could have moved the stack between the dSP and PUTBACK: dSP; BINOP myop; SV* res; Zero(&myop, 1, BINOP); myop.op_last = (OP *) &myop; myop.op_next = Nullop; myop.op_flags = OPf_KNOW|OPf_STACKED; ENTER; SAVESPTR(op); op = (OP *) &myop; PUTBACK; The PUTBACK and SPAGAIN in Perl_require_pv() were added by commit d3acc0f7e5197310 (June 1998) which also added the PUSHSTACKi(). They have both been redundant since they were added.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index 041607bbe3..5a4a80e9c3 100644
--- a/gv.c
+++ b/gv.c
@@ -3187,7 +3187,6 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags)
PL_op = (OP *) &myop;
if (PERLDB_SUB && PL_curstash != PL_debstash)
PL_op->op_private |= OPpENTERSUB_DB;
- PUTBACK;
Perl_pp_pushmark(aTHX);
EXTEND(SP, notfound + 5);