$foo .= $bar doesn't warn if $foo is undefined, so simplify code.
[p5sagit/p5-mst-13.2.git] / scope.h
diff --git a/scope.h b/scope.h
index cace246..1506e5e 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -49,6 +49,9 @@
 #define SAVEt_BOOL             38
 #define SAVEt_SET_SVFLAGS      39
 #define SAVEt_SAVESWITCHSTACK  40
+#define SAVEt_COP_ARYBASE      41
+#define SAVEt_RE_STATE         42
+#define SAVEt_COMPILE_WARNINGS 43
 
 #ifndef SCOPE_SAVES_SIGNAL_MASK
 #define SCOPE_SAVES_SIGNAL_MASK 0
@@ -150,11 +153,17 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
 
 #define SAVEHINTS() \
     STMT_START {                                       \
-       SSCHECK(3);                                     \
+       SSCHECK(4);                                     \
        if (PL_hints & HINT_LOCALIZE_HH) {              \
            SSPUSHPTR(GvHV(PL_hintgv));                 \
-           GvHV(PL_hintgv) = newHVhv(GvHV(PL_hintgv)); \
+           GvHV(PL_hintgv) = Perl_hv_copy_hints_hv(aTHX_ GvHV(PL_hintgv)); \
+       }                                               \
+       if (PL_compiling.cop_hints) {                   \
+           HINTS_REFCNT_LOCK;                          \
+           PL_compiling.cop_hints->refcounted_he_refcnt++;     \
+           HINTS_REFCNT_UNLOCK;                        \
        }                                               \
+       SSPUSHPTR(PL_compiling.cop_hints);              \
        SSPUSHINT(PL_hints);                            \
        SSPUSHINT(SAVEt_HINTS);                         \
     } STMT_END
@@ -176,6 +185,26 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
        PL_curstackinfo->si_stack = (t);                \
     } STMT_END
 
+#define SAVECOPARYBASE(c) \
+    STMT_START {                                       \
+       SSCHECK(3);                                     \
+       SSPUSHINT(CopARYBASE_get(c));                   \
+       SSPUSHPTR(c);                                   \
+       SSPUSHINT(SAVEt_COP_ARYBASE);                   \
+    } STMT_END
+
+/* Need to do the cop warnings like this, rather than a "SAVEFREESHAREDPV",
+   because realloc() means that the value can actually change. Possibly
+   could have done savefreesharedpvREF, but this way actually seems cleaner,
+   as it simplifies the code that does the saves, and reduces the load on the
+   save stack.  */
+#define SAVECOMPILEWARNINGS() \
+    STMT_START {                                       \
+       SSCHECK(2);                                     \
+       SSPUSHPTR(PL_compiling.cop_warnings);           \
+       SSPUSHINT(SAVEt_COMPILE_WARNINGS);              \
+    } STMT_END
+
 #ifdef USE_ITHREADS
 #  define SAVECOPSTASH(c)      SAVEPPTR(CopSTASHPV(c))
 #  define SAVECOPSTASH_FREE(c) SAVESHAREDPV(CopSTASHPV(c))