From: Nicholas Clark Date: Mon, 23 May 2005 20:26:35 +0000 (+0000) Subject: Don't allocate an IV slot where the type doesn't use the IV slot. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9f1501b2c542cf2dc1feaf9b0d1d694acd6c0807;p=p5sagit%2Fp5-mst-13.2.git Don't allocate an IV slot where the type doesn't use the IV slot. p4raw-id: //depot/perl@24557 --- diff --git a/av.h b/av.h index cc5dd5e..05e09c5 100644 --- a/av.h +++ b/av.h @@ -26,7 +26,26 @@ struct xpvav { HV* xmg_stash; /* class package */ }; +#if 0 typedef struct xpvav xpvav_allocated; +#else +typedef struct { + SSize_t xav_fill; /* Index of last element present */ + SSize_t xav_max; /* max index for which array has 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 */ +} xpvav_allocated; +#endif /* SV** xav_alloc; */ #define xav_alloc xnv_u.xnv_s.xnv_p1 diff --git a/hv.h b/hv.h index 90d9115..0d1f975 100644 --- a/hv.h +++ b/hv.h @@ -63,7 +63,26 @@ struct xpvhv { #define xhv_aux xnv_u.xnv_s.xnv_p1 #define xhv_keys xnv_u.xnv_s.xnv_u2.xnv_i2 +#if 0 typedef struct xpvhv xpvhv_allocated; +#else +typedef struct { + STRLEN xhv_fill; /* how full xhv_array currently is */ + STRLEN xhv_max; /* subscript of last element of xhv_array */ + 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 */ +} xpvhv_allocated; +#endif /* hash a key */ /* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins diff --git a/sv.h b/sv.h index bfc4778..2fb5f4d 100644 --- a/sv.h +++ b/sv.h @@ -280,7 +280,14 @@ struct xpv { STRLEN xpv_len; /* allocated size */ }; +#if 0 typedef struct xpv xpv_allocated; +#else +typedef struct { + STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_len; /* allocated size */ +} xpv_allocated; +#endif struct xpviv { IV xiv_iv; /* integer value or pv offset */