This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
move SAVETMPS next to PUSHEVAL
authorDavid Mitchell <davem@iabyn.com>
Fri, 17 Jul 2015 20:51:25 +0000 (21:51 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:37 +0000 (08:59 +0000)
In the various places where PUSHEVAL() is used, a SAVETMPS appears
shortly before it. Move each occurrence of SAVETMPS to just after the
SAVETMPS, in preparation shortly for making PUSHEVAL responsible for
saving PL_tmps_floor.

In theory this could make certain temporary items created during
eval/require startup to be freed slightly later. I don't know whether
this is is an issue or not. No tests fail ;-)

pp_ctl.c

index deeb583..9436bd1 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4046,7 +4046,6 @@ PP(pp_require)
     }
 
     ENTER_with_name("eval");
-    SAVETMPS;
     SAVECOPFILE_FREE(&PL_compiling);
     CopFILE_set(&PL_compiling, tryname);
     lex_start(NULL, tryrsfp, 0);
@@ -4068,6 +4067,7 @@ PP(pp_require)
     /* switch to eval mode */
     PUSHBLOCK(cx, CXt_EVAL, SP);
     PUSHEVAL(cx, name);
+    SAVETMPS;
     cx->blk_eval.retop = PL_op->op_next;
 
     SAVECOPLINE(&PL_compiling);
@@ -4155,7 +4155,6 @@ PP(pp_entereval)
                           : bytes ? LEX_EVALBYTES : LEX_START_SAME_FILTER
                        )
             );
-    SAVETMPS;
 
     /* switch to eval mode */
 
@@ -4182,6 +4181,7 @@ PP(pp_entereval)
 
     PUSHBLOCK(cx, (CXt_EVAL|CXp_REAL), SP);
     PUSHEVAL(cx, 0);
+    SAVETMPS;
     cx->blk_eval.retop = PL_op->op_next;
 
     /* prepare to compile string */
@@ -4306,10 +4306,10 @@ Perl_create_eval_scope(pTHX_ U32 flags)
     const I32 gimme = GIMME_V;
        
     ENTER_with_name("eval_scope");
-    SAVETMPS;
 
     PUSHBLOCK(cx, (CXt_EVAL|CXp_TRYBLOCK), PL_stack_sp);
     PUSHEVAL(cx, 0);
+    SAVETMPS;
 
     PL_in_eval = EVAL_INEVAL;
     if (flags & G_KEEPERR)