In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/e77da3b2183d0f9c5ea81dc5780d9a480fc4fa88?hp=ef01b67f31004ca818c73987384945a0fea605d6>

- Log -----------------------------------------------------------------
commit e77da3b2183d0f9c5ea81dc5780d9a480fc4fa88
Author: Nicholas Clark <[email protected]>
Date:   Tue Jan 26 12:00:56 2010 +0000

    SvIVX() isn't valid on SVt_REGEXP

M       dump.c
M       ext/Devel-Peek/t/Peek.t
M       sv.h

commit 65ac1738675fbcf49a4c9d625c0c43dd73e6ff2f
Author: Nicholas Clark <[email protected]>
Date:   Mon Jan 25 10:53:33 2010 +0000

    In sv.c, _all_ {new,del}_X* macros can be *_body_allocated.
    
    Previously those where bodies_by_type[sv_type].offset was zero were using
    {new,del}_body_typed. However, the optimiser can spot this, and generates 
the
    same object code. This allows simplification of the C code, and more
    flexibility to rearrange the structures without generating bugs.

M       sv.c
-----------------------------------------------------------------------

Summary of changes:
 dump.c                  |    2 +-
 ext/Devel-Peek/t/Peek.t |    1 -
 sv.c                    |   23 ++++++++---------------
 sv.h                    |    3 +++
 4 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/dump.c b/dump.c
index 83ced6a..6bfe5f4 100644
--- a/dump.c
+++ b/dump.c
@@ -1596,7 +1596,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, 
I32 nest, I32 maxnest, bo
     }
     if ((type >= SVt_PVIV && type != SVt_PVAV && type != SVt_PVHV
         && type != SVt_PVCV && !isGV_with_GP(sv) && type != SVt_PVFM
-        && type != SVt_PVIO)
+        && type != SVt_PVIO && type != SVt_REGEXP)
        || (type == SVt_IV && !SvROK(sv))) {
        if (SvIsUV(sv)
 #ifdef PERL_OLD_COPY_ON_WRITE
diff --git a/ext/Devel-Peek/t/Peek.t b/ext/Devel-Peek/t/Peek.t
index 3d282d3..e4ccbf5 100644
--- a/ext/Devel-Peek/t/Peek.t
+++ b/ext/Devel-Peek/t/Peek.t
@@ -327,7 +327,6 @@ do_test(15,
   SV = REGEXP\\($ADDR\\) at $ADDR
     REFCNT = 1
     FLAGS = \\(OBJECT,POK,FAKE,pPOK\\)
-    IV = 0
     PV = $ADDR "\\(\\?-xism:tic\\)"
     CUR = 12
     LEN = 0
diff --git a/sv.c b/sv.c
index db11794..47822f0 100644
--- a/sv.c
+++ b/sv.c
@@ -989,13 +989,6 @@ static const struct body_details bodies_by_type[] = {
       FIT_ARENA(24, sizeof(XPVIO) - STRUCT_OFFSET(XPVIO, xpv_cur)) },
 };
 
-#define new_body_type(sv_type)         \
-    (void *)((char *)S_new_body(aTHX_ sv_type))
-
-#define del_body_type(p, sv_type)      \
-    del_body(p, &PL_body_roots[sv_type])
-
-
 #define new_body_allocated(sv_type)            \
     (void *)((char *)S_new_body(aTHX_ sv_type) \
             - bodies_by_type[sv_type].offset)
@@ -1030,11 +1023,11 @@ static const struct body_details bodies_by_type[] = {
 
 #else /* !PURIFY */
 
-#define new_XNV()      new_body_type(SVt_NV)
-#define del_XNV(p)     del_body_type(p, SVt_NV)
+#define new_XNV()      new_body_allocated(SVt_NV)
+#define del_XNV(p)     del_body_allocated(p, SVt_NV)
 
-#define new_XPVNV()    new_body_type(SVt_PVNV)
-#define del_XPVNV(p)   del_body_type(p, SVt_PVNV)
+#define new_XPVNV()    new_body_allocated(SVt_PVNV)
+#define del_XPVNV(p)   del_body_allocated(p, SVt_PVNV)
 
 #define new_XPVAV()    new_body_allocated(SVt_PVAV)
 #define del_XPVAV(p)   del_body_allocated(p, SVt_PVAV)
@@ -1042,11 +1035,11 @@ static const struct body_details bodies_by_type[] = {
 #define new_XPVHV()    new_body_allocated(SVt_PVHV)
 #define del_XPVHV(p)   del_body_allocated(p, SVt_PVHV)
 
-#define new_XPVMG()    new_body_type(SVt_PVMG)
-#define del_XPVMG(p)   del_body_type(p, SVt_PVMG)
+#define new_XPVMG()    new_body_allocated(SVt_PVMG)
+#define del_XPVMG(p)   del_body_allocated(p, SVt_PVMG)
 
-#define new_XPVGV()    new_body_type(SVt_PVGV)
-#define del_XPVGV(p)   del_body_type(p, SVt_PVGV)
+#define new_XPVGV()    new_body_allocated(SVt_PVGV)
+#define del_XPVGV(p)   del_body_allocated(p, SVt_PVGV)
 
 #endif /* PURIFY */
 
diff --git a/sv.h b/sv.h
index 7d3f1a6..40da47b 100644
--- a/sv.h
+++ b/sv.h
@@ -1068,6 +1068,7 @@ the scalar's value cannot change unless written to.
            assert(SvTYPE(_svivx) != SVt_PVCV);                         \
            assert(SvTYPE(_svivx) != SVt_PVFM);                         \
            assert(SvTYPE(_svivx) != SVt_PVIO);                         \
+           assert(SvTYPE(_svivx) != SVt_REGEXP);                       \
            assert(!isGV_with_GP(_svivx));                              \
            &(((XPVIV*) MUTABLE_PTR(SvANY(_svivx)))->xiv_iv);           \
         }))
@@ -1079,6 +1080,7 @@ the scalar's value cannot change unless written to.
            assert(SvTYPE(_svuvx) != SVt_PVCV);                         \
            assert(SvTYPE(_svuvx) != SVt_PVFM);                         \
            assert(SvTYPE(_svuvx) != SVt_PVIO);                         \
+           assert(SvTYPE(_svuvx) != SVt_REGEXP);                       \
            assert(!isGV_with_GP(_svuvx));                              \
            &(((XPVUV*) MUTABLE_PTR(SvANY(_svuvx)))->xuv_uv);           \
         }))
@@ -1090,6 +1092,7 @@ the scalar's value cannot change unless written to.
            assert(SvTYPE(_svnvx) != SVt_PVCV);                         \
            assert(SvTYPE(_svnvx) != SVt_PVFM);                         \
            assert(SvTYPE(_svnvx) != SVt_PVIO);                         \
+           assert(SvTYPE(_svnvx) != SVt_REGEXP);                       \
            assert(!isGV_with_GP(_svnvx));                              \
            &(((XPVNV*) MUTABLE_PTR(SvANY(_svnvx)))->xnv_u.xnv_nv);     \
         }))

--
Perl5 Master Repository

Reply via email to