the memory to store pointers and integers.
(Part 1 - will be reworked to be more efficient when IV or void*
is 64 bit soon)
p4raw-id: //depot/perl@24538
struct xpvav {
SSize_t xav_fill; /* Index of last element present */
SSize_t xav_max; /* max index for which array has space */
- IV xof_off; /* ptr is incremented by offset */
- NV xnv_nv; /* numeric value, if any */
+ IV this_space;
+ union {
+ NV xnvu_nv;
+ struct {
+ void *xnv_p1; /* pointer to beginning of C array of SVs */
+ union {
+ void *xnv_p2;
+ IV xnv_i2;
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
MAGIC* xmg_magic; /* magic for scalar array */
HV* xmg_stash; /* class package */
-
- SV** xav_alloc; /* pointer to beginning of C array of SVs */
- SV* xav_arylen;
};
+/* SV** xav_alloc; */
+#define xav_alloc xnv_u.xnv_s.xnv_p1
+/* SV* xav_arylen; */
+#define xav_arylen xnv_u.xnv_s.xnv_u2.xnv_p2
/* AVf_REAL is set for all AVs whose xav_array contents are refcounted.
* Some things like "@_" and the scratchpad list do not set this, to
#define Nullav Null(AV*)
#define AvARRAY(av) ((av)->sv_u.sv_array)
-#define AvALLOC(av) ((XPVAV*) SvANY(av))->xav_alloc
+#define AvALLOC(av) (*((SV***)&((XPVAV*) SvANY(av))->xav_alloc))
#define AvMAX(av) ((XPVAV*) SvANY(av))->xav_max
#define AvFILLp(av) ((XPVAV*) SvANY(av))->xav_fill
-#define AvARYLEN(av) ((XPVAV*) SvANY(av))->xav_arylen
+#define AvARYLEN(av) (*((SV**)&((XPVAV*) SvANY(av))->xav_arylen))
#define AvREAL(av) (SvFLAGS(av) & SVpav_REAL)
#define AvREAL_on(av) (SvFLAGS(av) |= SVpav_REAL)
STRLEN xpv_cur; /* length of xp_pv as a C string */
STRLEN xpv_len; /* allocated size */
IV xof_off; /* integer value */
- NV xnv_nv; /* numeric value, if any */
+ union {
+ NV xnvu_nv; /* numeric value, if any */
+ struct {
+ void *xnv_p1;
+ union {
+ void *xnv_p2;
+ IV xnv_i2;
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
MAGIC* xmg_magic; /* magic for scalar array */
HV* xmg_stash; /* class package */
SvREFCNT_dec(d);
return;
}
- if (type >= SVt_PVIV || type == SVt_IV) {
+ if ((type >= SVt_PVIV && type != SVt_PVAV && type != SVt_PVHV)
+ || type == SVt_IV) {
if (SvIsUV(sv)
#ifdef PERL_COPY_ON_WRITE
|| SvIsCOW(sv)
#endif
PerlIO_putc(file, '\n');
}
- if (type >= SVt_PVNV || type == SVt_NV) {
+ if ((type >= SVt_PVNV && type != SVt_PVAV && type != SVt_PVHV)
+ || type == SVt_NV) {
STORE_NUMERIC_LOCAL_SET_STANDARD();
/* %Vg doesn't work? --jhi */
#ifdef USE_LONG_DOUBLE
=item MAX
-=item OFF
-
=item ARRAY
=item ARRAYelt
AvMAX(av)
B::AV av
-#define AvOFF(av) ((XPVAV*)SvANY(av))->xof_off
-
-IV
-AvOFF(av)
- B::AV av
-
void
AvARRAY(av)
B::AV av
SV = PVAV\\($ADDR\\) at $ADDR
REFCNT = 2
FLAGS = \\(\\)
- IV = 0
- NV = 0
ARRAY = $ADDR
FILL = 1
MAX = 1
SV = PVHV\\($ADDR\\) at $ADDR
REFCNT = 2
FLAGS = \\(SHAREKEYS\\)
- IV = 1
- NV = $FLOAT
ARRAY = $ADDR \\(0:7, 1:1\\)
hash quality = 100.0%
KEYS = 1
SV = PVHV\\($ADDR\\) at $ADDR
REFCNT = 2
FLAGS = \\(OBJECT,SHAREKEYS\\)
- IV = 0
- NV = 0
STASH = $ADDR\\t"Tac"
ARRAY = 0x0
KEYS = 0
SV = PVHV\\($ADDR\\) at $ADDR
REFCNT = 2
FLAGS = \\(SHAREKEYS,HASKFLAGS\\)
- UV = 1
- NV = $FLOAT
ARRAY = $ADDR \\(0:7, 1:1\\)
hash quality = 100.0%
KEYS = 1
SV = PVHV\\($ADDR\\) at $ADDR
REFCNT = 2
FLAGS = \\(SHAREKEYS,HASKFLAGS\\)
- UV = 1
- NV = 0
ARRAY = $ADDR \\(0:7, 1:1\\)
hash quality = 100.0%
KEYS = 1
struct xpvhv {
STRLEN xhv_fill; /* how full xhv_array currently is */
STRLEN xhv_max; /* subscript of last element of xhv_array */
- IV xhv_keys; /* how many elements in the array */
- NV xnv_nv; /* numeric value, if any */
+ IV for_rent;
+ union {
+ NV xnvu_nv; /* numeric value, if any */
+ struct {
+ void *xnv_p1;
+ union {
+ void *xnv_p2;
+ IV xnv_i2; /* how many elements in the array */
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
MAGIC* xmg_magic; /* magic for scalar array */
HV* xmg_stash; /* class package */
-
- struct xpvhv_aux* xhv_aux;
/* list of pm's for this package is now stored in symtab magic. */
};
+#define xhv_aux xnv_u.xnv_s.xnv_p1
+#define xhv_keys xnv_u.xnv_s.xnv_u2.xnv_i2
+
+
/* hash a key */
/* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins
* from requirements by Colin Plumb.
STRLEN xpv_cur; /* length of sv_pv as a C string */
STRLEN xpv_len; /* allocated size */
IV xiv_iv; /* integer value or pv offset */
- NV xnv_nv; /* numeric value, if any */
+ union {
+ NV xnvu_nv; /* numeric value, if any */
+ struct {
+ void *xnv_p1;
+ union {
+ void *xnv_p2;
+ IV xnv_i2;
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
};
+#define xnv_nv xnv_u.xnvu_nv
+
/* These structure must match the beginning of struct xpvhv in hv.h. */
struct xpvmg {
STRLEN xpv_cur; /* length of sv_pv as a C string */
STRLEN xpv_len; /* allocated size */
IV xiv_iv; /* integer value or pv offset */
- NV xnv_nv; /* numeric value, if any */
+ union {
+ NV xnvu_nv; /* numeric value, if any */
+ struct {
+ void *xnv_p1;
+ union {
+ void *xnv_p2;
+ IV xnv_i2;
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
};
STRLEN xpv_cur; /* length of sv_pv as a C string */
STRLEN xpv_len; /* allocated size */
IV xiv_iv; /* integer value or pv offset */
- NV xnv_nv; /* numeric value, if any */
+ union {
+ NV xnvu_nv; /* numeric value, if any */
+ struct {
+ void *xnv_p1;
+ union {
+ void *xnv_p2;
+ IV xnv_i2;
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
STRLEN xpv_cur; /* length of sv_pv as a C string */
STRLEN xpv_len; /* allocated size */
IV xiv_iv; /* integer value or pv offset */
- NV xnv_nv; /* numeric value, if any */
+ union {
+ NV xnvu_nv; /* numeric value, if any */
+ struct {
+ void *xnv_p1;
+ union {
+ void *xnv_p2;
+ IV xnv_i2;
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
STRLEN xpv_cur; /* length of sv_pv as a C string */
STRLEN xpv_len; /* allocated size */
IV xiv_iv; /* integer value or pv offset */
- NV xnv_nv; /* numeric value, if any */
+ union {
+ NV xnvu_nv; /* numeric value, if any */
+ struct {
+ void *xnv_p1;
+ union {
+ void *xnv_p2;
+ IV xnv_i2;
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
STRLEN xpv_cur; /* length of sv_pv as a C string */
STRLEN xpv_len; /* allocated size */
IV xiv_iv; /* integer value or pv offset */
- NV xnv_nv; /* numeric value, if any */
+ union {
+ NV xnvu_nv; /* numeric value, if any */
+ struct {
+ void *xnv_p1;
+ union {
+ void *xnv_p2;
+ IV xnv_i2;
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
STRLEN xpv_cur; /* length of sv_pv as a C string */
STRLEN xpv_len; /* allocated size */
IV xiv_iv; /* integer value or pv offset */
- NV xnv_nv; /* numeric value, if any */
+ union {
+ NV xnvu_nv; /* numeric value, if any */
+ struct {
+ void *xnv_p1;
+ union {
+ void *xnv_p2;
+ IV xnv_i2;
+ } xnv_u2;
+ } xnv_s;
+ } xnv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */