From: Nicholas Clark Date: Mon, 25 Jan 2010 09:27:56 +0000 (+0000) Subject: In the SV body, exchange the positions of the NV and stash/magic. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6e1287864cd02fb6f429f12a995e1c08e03572b9;p=p5sagit%2Fp5-mst-13.2.git In the SV body, exchange the positions of the NV and stash/magic. --- diff --git a/av.h b/av.h index f8c9d1b..f9af3ce 100644 --- a/av.h +++ b/av.h @@ -9,10 +9,11 @@ */ struct xpvav { - union _xnvu xnv_u; + HV* xmg_stash; /* class package */ + union _xmgu xmg_u; SSize_t xav_fill; /* Index of last element present */ SSize_t xav_max; /* max index for which array has space */ - _XPVMG_HEAD; + union _xivu xiv_u; }; /* SV** xav_alloc; */ diff --git a/cv.h b/cv.h index 290019d..d7dcc4a 100644 --- a/cv.h +++ b/cv.h @@ -12,7 +12,6 @@ struct xpvcv { _XPV_HEAD; - _XPVMG_HEAD; _XPVCV_COMMON; }; diff --git a/hv.h b/hv.h index f38d584..4381994 100644 --- a/hv.h +++ b/hv.h @@ -83,10 +83,11 @@ struct xpvhv_aux { /* hash structure: */ /* This structure must match the beginning of struct xpvmg in sv.h. */ struct xpvhv { - union _xnvu xnv_u; + HV* xmg_stash; /* class package */ + union _xmgu xmg_u; STRLEN xhv_fill; /* how full xhv_array currently is */ STRLEN xhv_max; /* subscript of last element of xhv_array */ - _XPVMG_HEAD; + union _xivu xiv_u; }; #define xhv_keys xiv_u.xivu_iv diff --git a/regexp.h b/regexp.h index a9dd2e1..5d84358 100644 --- a/regexp.h +++ b/regexp.h @@ -103,7 +103,7 @@ typedef struct regexp_paren_pair { typedef struct regexp { _XPV_HEAD; - _XPVMG_HEAD; + union _xivu xiv_u; _REGEXP_COMMON; } regexp; diff --git a/sv.c b/sv.c index f82c82c..016a142 100644 --- a/sv.c +++ b/sv.c @@ -915,8 +915,9 @@ static const struct body_details bodies_by_type[] = { }, /* 8 bytes on most ILP32 with IEEE doubles */ - { sizeof(NV), sizeof(NV), 0, SVt_NV, FALSE, HADNV, HASARENA, - FIT_ARENA(0, sizeof(NV)) }, + { sizeof(NV), sizeof(NV), + STRUCT_OFFSET(XPVNV, xnv_u), + SVt_NV, FALSE, HADNV, HASARENA, FIT_ARENA(0, sizeof(NV)) }, /* 8 bytes on most ILP32 with IEEE doubles */ { sizeof(XPV), @@ -933,11 +934,11 @@ static const struct body_details bodies_by_type[] = { FIT_ARENA(0, sizeof(XPV)) }, /* 20 */ - { sizeof(XPVNV), copy_length(XPVNV, xiv_u), 0, SVt_PVNV, FALSE, HADNV, + { sizeof(XPVNV), copy_length(XPVNV, xnv_u), 0, SVt_PVNV, FALSE, HADNV, HASARENA, FIT_ARENA(0, sizeof(XPVNV)) }, /* 28 */ - { sizeof(XPVMG), copy_length(XPVMG, xmg_stash), 0, SVt_PVMG, FALSE, HADNV, + { sizeof(XPVMG), copy_length(XPVMG, xnv_u), 0, SVt_PVMG, FALSE, HADNV, HASARENA, FIT_ARENA(0, sizeof(XPVMG)) }, /* something big */ @@ -957,13 +958,13 @@ static const struct body_details bodies_by_type[] = { HASARENA, FIT_ARENA(0, sizeof(XPVLV)) }, { sizeof(XPVAV), - copy_length(XPVAV, xmg_stash), + copy_length(XPVAV, xiv_u), 0, SVt_PVAV, TRUE, NONV, HASARENA, FIT_ARENA(0, sizeof(XPVAV)) }, { sizeof(XPVHV), - copy_length(XPVHV, xmg_stash), + copy_length(XPVHV, xiv_u), 0, SVt_PVHV, TRUE, NONV, HASARENA, FIT_ARENA(0, sizeof(XPVHV)) }, diff --git a/sv.h b/sv.h index 40da47b..f88f139 100644 --- a/sv.h +++ b/sv.h @@ -394,8 +394,9 @@ perform the upgrade if necessary. See C. /* RV upwards. However, SVf_ROK and SVp_IOK are exclusive */ #define SVprv_WEAKREF 0x80000000 /* Weak reference */ -#define _XPV_HEAD \ - union _xnvu xnv_u; \ +#define _XPV_HEAD \ + HV* xmg_stash; /* class package */ \ + union _xmgu xmg_u; \ STRLEN xpv_cur; /* length of svu_pv as a C string */ \ STRLEN xpv_len /* allocated size */ @@ -449,23 +450,20 @@ struct xpvuv { struct xpvnv { _XPV_HEAD; union _xivu xiv_u; + union _xnvu xnv_u; }; -#define _XPVMG_HEAD \ - union _xivu xiv_u; \ - union _xmgu xmg_u; \ - HV* xmg_stash /* class package */ - /* This structure must match the beginning of struct xpvhv in hv.h. */ struct xpvmg { _XPV_HEAD; - _XPVMG_HEAD; + union _xivu xiv_u; + union _xnvu xnv_u; }; struct xpvlv { _XPV_HEAD; - _XPVMG_HEAD; - + union _xivu xiv_u; + union _xnvu xnv_u; STRLEN xlv_targoff; STRLEN xlv_targlen; SV* xlv_targ; @@ -477,7 +475,8 @@ struct xpvlv { Boyer-Moore. */ struct xpvgv { _XPV_HEAD; - _XPVMG_HEAD; + union _xivu xiv_u; + union _xnvu xnv_u; }; /* This structure must match XPVCV in cv.h */ @@ -485,6 +484,7 @@ struct xpvgv { typedef U16 cv_flags_t; #define _XPVCV_COMMON \ + union _xivu xiv_u; \ HV * xcv_stash; \ union { \ OP * xcv_start; \ @@ -505,7 +505,6 @@ typedef U16 cv_flags_t; struct xpvfm { _XPV_HEAD; - _XPVMG_HEAD; _XPVCV_COMMON; }; @@ -541,7 +540,7 @@ struct xpvfm { struct xpvio { _XPV_HEAD; - _XPVMG_HEAD; + union _xivu xiv_u; _XPVIO_TAIL; };