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:
Nicholas Clark
Date:
May 25, 2013 15:05
Subject:
Re: [perl #118055] miniperl fails with SIGBUS on sparc(usethreads+use64bitint)
Message ID:
20130525150454.GB3729@plum.flirble.org
On Sat, May 25, 2013 at 10:57:47AM -0400, Andy Dougherty wrote:

> It's just taking a long time to actually finish.  I'll report back when it 
> does.
> 
> Meanwhile, what would you think about tweaking it like this:
> 
> diff --git a/op.c b/op.c
> index 792e8d6..fd69c56 100644
> --- 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);
>  
> -#if defined(USE_ITHREADS) && IVSIZE > U32SIZE
> +#if defined(USE_ITHREADS) && IVSIZE > U32SIZE && !defined(__x86_64__)
>      /* 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

Good point. But I think that that's more restrictive than it needs to be.
I think that this would be valid:

#if defined(USE_ITHREADS) && IVSIZE > U32SIZE && IVSIZE > PTRSIZE

(but I have not yet tested it)

> As far as I am aware, the alignment isn't an issue on x86_64, but there is 
> a small, but barely measureable, cost to the if(sz == sizeof(struct pmop)) 
> test even in cases where it isn't used.  Fiddling a bit with perbench 
> benchmarks, this modified version of one of the hash tests:

and would avoid that cost on other 64 bit platforms.

> my $i = "abcdefg";
> for (1..2000) {
>     for my $j (1..2000) {
> 	$hash{$i} = $j;
>     }
>     $i++;
> }
> 
> my $k;
> foreach $k (keys %hash) {
>    my $v = $hash{$k};
> }
> 
> ran slightly quicker on x86_64 (differences were consistently at the 2-3 
> sigma level as reported by dumbbench) with that suggested tweak.

That's a test doing work at runtime, which is affected by a compile-time
change? As best I can work out, there are no OPs allocated at runtime by
that code.

Nicholas Clark

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