Introduce save_aelem_flags()
Vincent Pit [Fri, 24 Jul 2009 22:15:07 +0000 (00:15 +0200)]
It's the symmetric of save_helem_flags(). save_aelem() is now a macro wrapping around save_aelem_flags().

embed.fnc
embed.h
global.sym
proto.h
scope.c
scope.h

index 0001d1f..bfc9425 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -882,7 +882,8 @@ Apda        |char*  |savesharedpvn  |NN const char *const pv|const STRLEN len
 Apda   |char*  |savesvpv       |NN SV* sv
 Ap     |void   |savestack_grow
 Ap     |void   |savestack_grow_cnt     |I32 need
-Ap     |void   |save_aelem     |NN AV* av|I32 idx|NN SV **sptr
+Amp    |void   |save_aelem     |NN AV* av|I32 idx|NN SV **sptr
+Ap     |void   |save_aelem_flags|NN AV* av|I32 idx|NN SV **sptr|const U32 flags
 Ap     |I32    |save_alloc     |I32 size|I32 pad
 Ap     |void   |save_aptr      |NN AV** aptr
 Ap     |AV*    |save_ary       |NN GV* gv
diff --git a/embed.h b/embed.h
index e702d32..b602464 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define savesvpv               Perl_savesvpv
 #define savestack_grow         Perl_savestack_grow
 #define savestack_grow_cnt     Perl_savestack_grow_cnt
-#define save_aelem             Perl_save_aelem
+#define save_aelem_flags       Perl_save_aelem_flags
 #define save_alloc             Perl_save_alloc
 #define save_aptr              Perl_save_aptr
 #define save_ary               Perl_save_ary
 #define savesvpv(a)            Perl_savesvpv(aTHX_ a)
 #define savestack_grow()       Perl_savestack_grow(aTHX)
 #define savestack_grow_cnt(a)  Perl_savestack_grow_cnt(aTHX_ a)
-#define save_aelem(a,b,c)      Perl_save_aelem(aTHX_ a,b,c)
+#define save_aelem_flags(a,b,c,d)      Perl_save_aelem_flags(aTHX_ a,b,c,d)
 #define save_alloc(a,b)                Perl_save_alloc(aTHX_ a,b)
 #define save_aptr(a)           Perl_save_aptr(aTHX_ a)
 #define save_ary(a)            Perl_save_ary(aTHX_ a)
index 474e6bb..73bf5be 100644 (file)
@@ -433,7 +433,7 @@ Perl_savesharedpvn
 Perl_savesvpv
 Perl_savestack_grow
 Perl_savestack_grow_cnt
-Perl_save_aelem
+Perl_save_aelem_flags
 Perl_save_alloc
 Perl_save_aptr
 Perl_save_ary
diff --git a/proto.h b/proto.h
index b2e9e90..77464c5 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -2746,10 +2746,14 @@ PERL_CALLCONV char*     Perl_savesvpv(pTHX_ SV* sv)
 
 PERL_CALLCONV void     Perl_savestack_grow(pTHX);
 PERL_CALLCONV void     Perl_savestack_grow_cnt(pTHX_ I32 need);
-PERL_CALLCONV void     Perl_save_aelem(pTHX_ AV* av, I32 idx, SV **sptr)
+/* PERL_CALLCONV void  Perl_save_aelem(pTHX_ AV* av, I32 idx, SV **sptr)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_3); */
+
+PERL_CALLCONV void     Perl_save_aelem_flags(pTHX_ AV* av, I32 idx, SV **sptr, const U32 flags)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_3);
-#define PERL_ARGS_ASSERT_SAVE_AELEM    \
+#define PERL_ARGS_ASSERT_SAVE_AELEM_FLAGS      \
        assert(av); assert(sptr)
 
 PERL_CALLCONV I32      Perl_save_alloc(pTHX_ I32 size, I32 pad);
diff --git a/scope.c b/scope.c
index 20e027f..85f1c48 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -572,12 +572,12 @@ S_save_pushptri32ptr(pTHX_ void *const ptr1, const I32 i, void *const ptr2,
 }
 
 void
-Perl_save_aelem(pTHX_ AV *av, I32 idx, SV **sptr)
+Perl_save_aelem_flags(pTHX_ AV *av, I32 idx, SV **sptr, const U32 flags)
 {
     dVAR;
     SV *sv;
 
-    PERL_ARGS_ASSERT_SAVE_AELEM;
+    PERL_ARGS_ASSERT_SAVE_AELEM_FLAGS;
 
     SvGETMAGIC(*sptr);
     save_pushptri32ptr(SvREFCNT_inc_simple(av), idx, SvREFCNT_inc(*sptr),
@@ -585,7 +585,7 @@ Perl_save_aelem(pTHX_ AV *av, I32 idx, SV **sptr)
     /* if it gets reified later, the restore will have the wrong refcnt */
     if (!AvREAL(av) && AvREIFY(av))
        SvREFCNT_inc_void(*sptr);
-    save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */
+    save_scalar_at(sptr, flags); /* XXX - FIXME - see #60360 */
     sv = *sptr;
     /* If we're localizing a tied array element, this new sv
      * won't actually be stored in the array - so it won't get
diff --git a/scope.h b/scope.h
index 2b57fc6..7bda4c8 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -58,6 +58,7 @@
 
 #define SAVEf_SETMAGIC         1
 
+#define save_aelem(av,idx,sptr)        save_aelem_flags(av,idx,sptr,SAVEf_SETMAGIC)
 #define save_helem(hv,key,sptr)        save_helem_flags(hv,key,sptr,SAVEf_SETMAGIC)
 
 #ifndef SCOPE_SAVES_SIGNAL_MASK