This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove compile-time conditionals from PVIV and PVNV body sizes.
authorNicholas Clark <nick@ccl4.org>
Mon, 16 Aug 2010 15:12:24 +0000 (17:12 +0200)
committerNicholas Clark <nick@ccl4.org>
Mon, 16 Aug 2010 15:12:24 +0000 (17:12 +0200)
Alignment issues that aggressive (but legal) sparc compilers tripped over
were resolved by 69ba284b5e077075. Hence the conditional sizing added in
889d28b2ea2c1751 is not needed, and prevents viable size optimisations.

(The compiler could "see" that the structure contained a double, hence the
alignment was constrained, hence it was legal to use a single 64 bit load on 2
adjacent 32 bit values. Which fails badly when the structure isn't actually
aligned, which was possible prior to 69ba284b5e077075.)

sv.c

diff --git a/sv.c b/sv.c
index 385e9f7..8ab73ac 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -925,34 +925,19 @@ static const struct body_details bodies_by_type[] = {
       SVt_PV, FALSE, NONV, HASARENA,
       FIT_ARENA(0, sizeof(XPV) - STRUCT_OFFSET(XPV, xpv_cur)) },
 
-#if 2 *PTRSIZE <= IVSIZE
     /* 12 */
     { sizeof(XPVIV) - STRUCT_OFFSET(XPV, xpv_cur),
       copy_length(XPVIV, xiv_u) - STRUCT_OFFSET(XPV, xpv_cur),
       + STRUCT_OFFSET(XPV, xpv_cur),
       SVt_PVIV, FALSE, NONV, HASARENA,
       FIT_ARENA(0, sizeof(XPVIV) - STRUCT_OFFSET(XPV, xpv_cur)) },
-    /* 12 */
-#else
-    { sizeof(XPVIV),
-      copy_length(XPVIV, xiv_u),
-      0,
-      SVt_PVIV, FALSE, NONV, HASARENA,
-      FIT_ARENA(0, sizeof(XPVIV)) },
-#endif
 
-#if (2 *PTRSIZE <= IVSIZE) && (2 *PTRSIZE <= NVSIZE)
     /* 20 */
     { sizeof(XPVNV) - STRUCT_OFFSET(XPV, xpv_cur),
       copy_length(XPVNV, xnv_u) - STRUCT_OFFSET(XPV, xpv_cur),
       + STRUCT_OFFSET(XPV, xpv_cur),
       SVt_PVNV, FALSE, HADNV, HASARENA,
       FIT_ARENA(0, sizeof(XPVNV) - STRUCT_OFFSET(XPV, xpv_cur)) },
-#else
-    /* 20 */
-    { sizeof(XPVNV), copy_length(XPVNV, xnv_u), 0, SVt_PVNV, FALSE, HADNV,
-      HASARENA, FIT_ARENA(0, sizeof(XPVNV)) },
-#endif
 
     /* 28 */
     { sizeof(XPVMG), copy_length(XPVMG, xnv_u), 0, SVt_PVMG, FALSE, HADNV,