This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Improved struct pmop alignment fix - avoid the slow path on 64 bit systems.
authorNicholas Clark <nick@ccl4.org>
Sun, 26 May 2013 06:50:17 +0000 (08:50 +0200)
committerNicholas Clark <nick@ccl4.org>
Fri, 21 Jun 2013 14:06:00 +0000 (16:06 +0200)
Commit c2a50ddb1bed6576 works round an alignment bug in the slab allocator
for 32 bit systems built with 64 bit IVs. However, the C pre-processor logic
meant that the test path was enabled on true 64 bit systems. It's not needed
there, so improve the logic so that it isn't compiled for platforms where
pointers are 64 bit.

op.c

diff --git a/op.c b/op.c
index f7ecb9a..4276d3c 100644 (file)
--- a/op.c
+++ b/op.c
@@ -175,7 +175,7 @@ Perl_Slab_Alloc(pTHX_ size_t sz)
      || (CvSTART(PL_compcv) && !CvSLABBED(PL_compcv)))
        return PerlMemShared_calloc(1, sz);
 
      || (CvSTART(PL_compcv) && !CvSLABBED(PL_compcv)))
        return PerlMemShared_calloc(1, sz);
 
-#if defined(USE_ITHREADS) && IVSIZE > U32SIZE
+#if defined(USE_ITHREADS) && IVSIZE > U32SIZE && IVSIZE > PTRSIZE
     /* Work around a goof with alignment on our part. For sparc32 (and
        possibly other architectures), if built with -Duse64bitint, the IV
        op_pmoffset in struct pmop should be 8 byte aligned, but the slab
     /* Work around a goof with alignment on our part. For sparc32 (and
        possibly other architectures), if built with -Duse64bitint, the IV
        op_pmoffset in struct pmop should be 8 byte aligned, but the slab