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
Andy Dougherty
May 23, 2013 16:42
Re: [perl #118055] miniperl fails with SIGBUS on sparc(usethreads+use64bitint)
Message ID:
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

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About