This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Set PL_comppad_name on sub entry
authorFather Chrysostomos <sprout@cpan.org>
Mon, 10 Sep 2012 23:07:30 +0000 (16:07 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 16 Sep 2012 05:45:09 +0000 (22:45 -0700)
pad.h
scope.c
scope.h
sv.c

diff --git a/pad.h b/pad.h
index f65af17..a0b5573 100644 (file)
--- a/pad.h
+++ b/pad.h
@@ -172,7 +172,7 @@ XXX DAPM it would make more sense to make the arg a PADOFFSET
 Clear the pointed to pad value on scope exit. (i.e. the runtime action of 'my')
 
 =for apidoc m|void|SAVECOMPPAD
-save PL_comppad and PL_curpad
+Save PL_comppad_name, PL_comppad and PL_curpad.
 
 
 =for apidoc Amx|PAD **|PadlistARRAY|PADLIST padlist
@@ -318,6 +318,7 @@ Restore the old pad saved into the local variable opad by PAD_SAVE_LOCAL()
 
 
 #define PAD_SET_CUR_NOSAVE(padlist,nth) \
+       PL_comppad_name = PadlistNAMES(padlist);                \
        PL_comppad = (PAD*) (PadlistARRAY(padlist)[nth]);       \
        PL_curpad = AvARRAY(PL_comppad);                        \
        DEBUG_Xv(PerlIO_printf(Perl_debug_log,                  \
diff --git a/scope.c b/scope.c
index db2d43b..c3025f8 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -1090,6 +1090,7 @@ Perl_leave_scope(pTHX_ I32 base)
                PL_curpad = AvARRAY(PL_comppad);
            else
                PL_curpad = NULL;
+           PL_comppad_name = (PADNAMELIST*)SSPOPPTR;
            break;
        case SAVEt_PADSV_AND_MORTALIZE:
            {
diff --git a/scope.h b/scope.h
index 0fad9a3..a69be5f 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -208,7 +208,8 @@ scope has the given name. Name must be a literal string.
 
 #define SAVEHINTS()    save_hints()
 
-#define SAVECOMPPAD() save_pushptr(MUTABLE_SV(PL_comppad), SAVEt_COMPPAD)
+#define SAVECOMPPAD() save_pushptrptr(MUTABLE_SV(PL_comppad_name), \
+                                    MUTABLE_SV(PL_comppad), SAVEt_COMPPAD)
 
 #define SAVESWITCHSTACK(f,t) \
     STMT_START {                                       \
diff --git a/sv.c b/sv.c
index 2312a36..f361259 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -12469,6 +12469,8 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
            TOPPTR(nss,ix) = sv_dup_inc(sv, param);
            /* fall through */
        case SAVEt_COMPPAD:
+           sv = (const SV *) POPPTR(ss,ix);
+           TOPPTR(nss,ix) = sv_dup(sv, param);
        case SAVEt_NSTAB:
            sv = (const SV *) POPPTR(ss,ix);
            TOPPTR(nss,ix) = sv_dup(sv, param);