PVCVs don't need XNVs either.
Nicholas Clark [Mon, 20 Feb 2006 19:00:22 +0000 (19:00 +0000)]
(And actually remove xcv_depth)
(And fix the copy lengths in bodies_by_type)

p4raw-id: //depot/perl@27249

cv.h
dump.c
ext/B/B/Bytecode.pm
ext/Devel/Peek/t/Peek.t
sv.c

diff --git a/cv.h b/cv.h
index 224ac2c..873cecd 100644 (file)
--- a/cv.h
+++ b/cv.h
@@ -34,7 +34,6 @@ struct xpvcv {
     }          xcv_root_u;
     GV *       xcv_gv;
     char *     xcv_file;
-    long       xcv_depth;
     PADLIST *  xcv_padlist;
     CV *       xcv_outside;
     U32                xcv_outside_seq; /* the COP sequence (at the point of our
@@ -43,6 +42,37 @@ struct xpvcv {
     cv_flags_t xcv_flags;
 };
 
+typedef struct {
+    STRLEN     xpv_cur;        /* length of xp_pv as a C string */
+    STRLEN     xpv_len;        /* allocated size */
+    union {
+       IV      xivu_iv;
+       UV      xivu_uv;
+       void *  xivu_p1;
+       I32     xivu_i32;       /* depth, >= 2 indicates recursive call */
+    }          xiv_u;
+    MAGIC*     xmg_magic;      /* magic for scalar array */
+    HV*                xmg_stash;      /* class package */
+
+    HV *       xcv_stash;
+    union {
+       OP *    xcv_start;
+       ANY     xcv_xsubany;
+    }          xcv_start_u;
+    union {
+       OP *    xcv_root;
+       void    (*xcv_xsub) (pTHX_ CV*);
+    }          xcv_root_u;
+    GV *       xcv_gv;
+    char *     xcv_file;
+    PADLIST *  xcv_padlist;
+    CV *       xcv_outside;
+    U32                xcv_outside_seq; /* the COP sequence (at the point of our
+                                 * compilation) in the lexically enclosing
+                                 * sub */
+    cv_flags_t xcv_flags;
+} xpvcv_allocated;
+
 /*
 =head1 Handy Values
 
diff --git a/dump.c b/dump.c
index 3779d45..3057110 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -1304,7 +1304,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
        PerlIO_putc(file, '\n');
     }
     if ((type >= SVt_PVNV && type != SVt_PVAV && type != SVt_PVHV
-        && type != SVt_PVFM)
+        && type != SVt_PVCV && type != SVt_PVFM)
        || type == SVt_NV) {
        STORE_NUMERIC_LOCAL_SET_STANDARD();
        /* %Vg doesn't work? --jhi */
index 4497d44..6a30111 100644 (file)
@@ -257,7 +257,9 @@ sub B::PVNV::bsave {
        # Likewise HVs have no NV slot actually allocated.
        # I don't think that they can get here, but better safe than sorry
        return if $sv->isa('B::HV');
-    }
+       return if $sv->isa('B::CV');
+       return if $sv->isa('B::FM');
+     }
     asm "xnv", sprintf "%.40g", $sv->NVX;
 }
 
index 3d5d683..8897329 100644 (file)
@@ -38,6 +38,9 @@ sub do_test {
            $pattern =~ s/^ *\$ROOT *\n/
                ($] < 5.009) ? "    ROOT = 0x0\n" : '';
            /mge;
+           $pattern =~ s/^ *\$IVNV *\n/
+               ($] < 5.009) ? "    IV = 0\n    NV = 0\n" : '';
+           /mge;
 
 
 
@@ -218,7 +221,7 @@ do_test(13,
   SV = PVCV\\($ADDR\\) at $ADDR
     REFCNT = 2
     FLAGS = \\(PADMY,POK,pPOK,ANON,WEAKOUTSIDE\\)
-    NV = 0
+    $IVNV
     PROTOTYPE = ""
     COMP_STASH = $ADDR\\t"main"
     START = $ADDR ===> \\d+
@@ -244,7 +247,7 @@ do_test(14,
   SV = PVCV\\($ADDR\\) at $ADDR
     REFCNT = (3|4)
     FLAGS = \\(\\)
-    NV = 0
+    $IVNV
     COMP_STASH = $ADDR\\t"main"
     START = $ADDR ===> \\d+
     ROOT = $ADDR
@@ -489,7 +492,7 @@ do_test(23,
   SV = PVCV\\($ADDR\\) at $ADDR
     REFCNT = (2)
     FLAGS = \\(POK,pPOK,CONST\\)
-    NV = 0
+    $IVNV
     PROTOTYPE = ""
     COMP_STASH = 0x0
     $ROOT
diff --git a/sv.c b/sv.c
index 4f7f35a..f4e661c 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -969,15 +969,17 @@ static const struct body_details bodies_by_type[] = {
       + relative_STRUCT_OFFSET(xpvhv_allocated, XPVHV, xhv_fill),
       TRUE, HADNV, HASARENA, FIT_ARENA(0, sizeof(xpvhv_allocated)) },
 
-    /* 76 */
-    { sizeof(XPVCV), sizeof(XPVCV), 0, TRUE, HADNV,
-      HASARENA, FIT_ARENA(0, sizeof(XPVCV)) },
+    /* 56 */
+    { sizeof(xpvcv_allocated), sizeof(XPVCV)
+      - relative_STRUCT_OFFSET(xpvcv_allocated, XPVCV, xpv_cur),
+      + relative_STRUCT_OFFSET(xpvcv_allocated, XPVCV, xpv_cur),
+      TRUE, NONV, HASARENA, FIT_ARENA(0, sizeof(xpvcv_allocated)) },
 
     { sizeof(xpvfm_allocated),
-      sizeof(xpvfm_allocated)
+      sizeof(XPVFM)
       - relative_STRUCT_OFFSET(xpvfm_allocated, XPVFM, xpv_cur),
       + relative_STRUCT_OFFSET(xpvfm_allocated, XPVFM, xpv_cur),
-      TRUE, HADNV, NOARENA, FIT_ARENA(20, sizeof(xpvfm_allocated)) },
+      TRUE, NONV, NOARENA, FIT_ARENA(20, sizeof(xpvfm_allocated)) },
 
     /* XPVIO is 84 bytes, fits 48x */
     { sizeof(XPVIO), sizeof(XPVIO), 0, TRUE, HADNV,