For SAVEHINTS(), re-order the savestack to be (?:PTR, )? INT, PTR.
Nicholas Clark [Mon, 1 Dec 2008 10:36:44 +0000 (10:36 +0000)]
This brings it to the same order as save_aelem() or save_pushi32ptr().

p4raw-id: //depot/perl@34964

scope.c
scope.h
sv.c

diff --git a/scope.c b/scope.c
index 0923747..14ad0b3 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -902,9 +902,9 @@ Perl_leave_scope(pTHX_ I32 base)
                SvREFCNT_dec(MUTABLE_SV(GvHV(PL_hintgv)));
                GvHV(PL_hintgv) = NULL;
            }
-           *(I32*)&PL_hints = (I32)SSPOPINT;
            Perl_refcounted_he_free(aTHX_ PL_compiling.cop_hints_hash);
            PL_compiling.cop_hints_hash = (struct refcounted_he *) SSPOPPTR;
+           *(I32*)&PL_hints = (I32)SSPOPINT;
            if (PL_hints & HINT_LOCALIZE_HH) {
                SvREFCNT_dec(MUTABLE_SV(GvHV(PL_hintgv)));
                GvHV(PL_hintgv) = MUTABLE_HV(SSPOPPTR);
diff --git a/scope.h b/scope.h
index 152566a..bc80b97 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -159,18 +159,18 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
 
 #define SAVEHINTS() \
     STMT_START {                                       \
-       SSCHECK(4);                                     \
-       if (PL_hints & HINT_LOCALIZE_HH) {              \
-           SSPUSHPTR(GvHV(PL_hintgv));                 \
-           GvHV(PL_hintgv) = Perl_hv_copy_hints_hv(aTHX_ GvHV(PL_hintgv)); \
-       }                                               \
        if (PL_compiling.cop_hints_hash) {              \
            HINTS_REFCNT_LOCK;                          \
            PL_compiling.cop_hints_hash->refcounted_he_refcnt++;        \
            HINTS_REFCNT_UNLOCK;                        \
        }                                               \
-       SSPUSHPTR(PL_compiling.cop_hints_hash);         \
+       SSCHECK(4);                                     \
+       if (PL_hints & HINT_LOCALIZE_HH) {              \
+           SSPUSHPTR(GvHV(PL_hintgv));                 \
+           GvHV(PL_hintgv) = Perl_hv_copy_hints_hv(aTHX_ GvHV(PL_hintgv)); \
+       }                                               \
        SSPUSHINT(PL_hints);                            \
+       SSPUSHPTR(PL_compiling.cop_hints_hash);         \
        SSPUSHINT(SAVEt_HINTS);                         \
     } STMT_END
 
diff --git a/sv.c b/sv.c
index 2db30be..2a4c581 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11303,8 +11303,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
            TOPPTR(nss,ix) = ptr;
            break;
        case SAVEt_HINTS:
-           i = POPINT(ss,ix);
-           TOPINT(nss,ix) = i;
            ptr = POPPTR(ss,ix);
            if (ptr) {
                HINTS_REFCNT_LOCK;
@@ -11312,6 +11310,8 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
                HINTS_REFCNT_UNLOCK;
            }
            TOPPTR(nss,ix) = ptr;
+           i = POPINT(ss,ix);
+           TOPINT(nss,ix) = i;
            if (i & HINT_LOCALIZE_HH) {
                hv = (const HV *)POPPTR(ss,ix);
                TOPPTR(nss,ix) = hv_dup_inc(hv, param);