develooper Front page | perl.perl5.porters | Postings from May 2013

Re: [perl #118055] miniperl fails with SIGBUS on sparc(usethreads+use64bitint)

Thread Previous | Thread Next
From:
Andy Dougherty
Date:
May 23, 2013 16:42
Subject:
Re: [perl #118055] miniperl fails with SIGBUS on sparc(usethreads+use64bitint)
Message ID:
alpine.DEB.2.02.1305231234240.3771@fractal.phys.lafayette.edu
On Wed, 22 May 2013, Nicholas Clark wrote:

> Try this. It's against blead. The comment in the diff hunk will conflict
> against v5.18.0:
> 
> diff --git a/op.c b/op.c
> index 96a06b1..341b087 100644
> --- a/op.c
> +++ b/op.c
> @@ -175,6 +175,19 @@ Perl_Slab_Alloc(pTHX_ size_t sz)
>       || (CvSTART(PL_compcv) && !CvSLABBED(PL_compcv)))
>  	return PerlMemShared_calloc(1, sz);
>  
> +#if defined(USE_ITHREADS) && IVSIZE > U32SIZE
> +    /* 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
> +       allocator is only providing 4 byte alignment. The real fix is to change
> +       the IV to a type the same size as a pointer, such as size_t, but we
> +       can't do that without breaking the ABI, which is a no-no in a maint
> +       release. So instead, simply allocate struct pmop directly, which will be
> +       suitably aligned:  */
> +    if (sz == sizeof(struct pmop))
> +	return PerlMemShared_calloc(1, sz);
> +#endif
> +
>      /* While the subroutine is under construction, the slabs are accessed via
>         CvSTART(), to avoid needing to expand PVCV by one pointer for something
>         unneeded at runtime. Once a subroutine is constructed, the slabs are

I like that.  It's clean and clever, but not too clever.

So far, it built for me on Solaris/SPARC with

    gcc-4.6.0 -Dusethreads -Duse64bitint
    gcc-4.6.0 -Dusethreads
    gcc-4.6.0              -Duse64bitint

On the first two, all tests passed except op/threads.t.  Rerunning just 
that test with a longer timeout after test 9 passed in both cases.

On the third one, it's in the middle of building extensions.  This is slow
going -- Each of the first two variations took 9.5 hours (a little more than
7 hours is for the test suite).

-- 
    Andy Dougherty		doughera@lafayette.edu

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About