This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_ctl.c: Remove PL_curcop assignment
authorFather Chrysostomos <sprout@cpan.org>
Sat, 13 Sep 2014 03:22:27 +0000 (20:22 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 13 Sep 2014 03:23:25 +0000 (20:23 -0700)
This was added years ago in commit 7fb6a879.  Now that save_re_context
does nothing (and die_unwind no longer even calls it), we don’t need to
assign to PL_curcop.  In the case where it matters, that is, the implicit
eval scope that require provides, the values of PL_curcop and oldcop
should always be the same.

pp_ctl.c

index 0f69f97..429143f 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1614,7 +1614,9 @@ Perl_die_unwind(pTHX_ SV *msv)
            SV *namesv;
            PERL_CONTEXT *cx;
            SV **newsp;
+#ifdef DEBUGGING
            COP *oldcop;
+#endif DEBUGGING
            JMPENV *restartjmpenv;
            OP *restartop;
 
@@ -1631,7 +1633,9 @@ Perl_die_unwind(pTHX_ SV *msv)
            }
            POPEVAL(cx);
            namesv = cx->blk_eval.old_namesv;
+#ifdef DEBUGGING
            oldcop = cx->blk_oldcop;
+#endif DEBUGGING
            restartjmpenv = cx->blk_eval.cur_top_env;
            restartop = cx->blk_eval.retop;
 
@@ -1641,13 +1645,8 @@ Perl_die_unwind(pTHX_ SV *msv)
 
            LEAVE;
 
-           /* LEAVE could clobber PL_curcop (see save_re_context())
-            * XXX it might be better to find a way to avoid messing with
-            * PL_curcop in save_re_context() instead, but this is a more
-            * minimal fix --GSAR */
-           PL_curcop = oldcop;
-
            if (optype == OP_REQUIRE) {
+                assert (PL_curcop == oldcop);
                 (void)hv_store(GvHVn(PL_incgv),
                                SvPVX_const(namesv),
                                SvUTF8(namesv) ? -(I32)SvCUR(namesv) : (I32)SvCUR(namesv),