This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove dSP from a couple of pp_enter* fns
authorDavid Mitchell <davem@iabyn.com>
Mon, 18 Jan 2016 13:23:14 +0000 (13:23 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:19:22 +0000 (09:19 +0000)
These functions don't modify the args stack, so there's no need
to dSP; ...; PUTBACK.

Also write a negated bit test condition in pp_enterwhen() a bit less
clumsily.

pp_ctl.c

index d54dd93..9bab70a 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2035,14 +2035,13 @@ PP(pp_dbstate)
 
 PP(pp_enter)
 {
-    dSP;
     U8 gimme = GIMME_V;
 
-    (void)cx_pushblock(CXt_BLOCK, gimme, SP, PL_savestack_ix);
-
-    RETURN;
+    (void)cx_pushblock(CXt_BLOCK, gimme, PL_stack_sp, PL_savestack_ix);
+    return NORMAL;
 }
 
+
 PP(pp_leave)
 {
     PERL_CONTEXT *cx;
@@ -2212,16 +2211,15 @@ PP(pp_enteriter)
 
 PP(pp_enterloop)
 {
-    dSP;
     PERL_CONTEXT *cx;
     const U8 gimme = GIMME_V;
 
-    cx = cx_pushblock(CXt_LOOP_PLAIN, gimme, SP, PL_savestack_ix);
+    cx = cx_pushblock(CXt_LOOP_PLAIN, gimme, PL_stack_sp, PL_savestack_ix);
     cx_pushloop_plain(cx);
-
-    RETURN;
+    return NORMAL;
 }
 
+
 PP(pp_leaveloop)
 {
     PERL_CONTEXT *cx;
@@ -4925,7 +4923,7 @@ PP(pp_enterwhen)
        to the op that follows the leavewhen.
        RETURNOP calls PUTBACK which restores the stack pointer after the POPs.
     */
-    if ((0 == (PL_op->op_flags & OPf_SPECIAL)) && !SvTRUEx(POPs))
+    if (!(PL_op->op_flags & OPf_SPECIAL) && !SvTRUEx(POPs))
        RETURNOP(cLOGOP->op_other->op_next);
 
     cx = cx_pushblock(CXt_WHEN, gimme, SP, PL_savestack_ix);