[Pkg-db-devel] Re: (MIPS|amd64)/gcc-assembly mutexes [#11575]

Thiemo Seufer ica2_ts@csv.ica.uni-stuttgart.de
Thu, 9 Dec 2004 05:01:40 +0100


Kurt Roeckx wrote:
> On Wed, Dec 08, 2004 at 03:33:50PM -0500, Clint Adams wrote:
> > 
> > What does using RAX instead of EAX gain us?  I'm just curious.
> 
> Afaik, nothing.  It's just a 64 bit register instead of a 32 bit
> register.  It's not faster or anything.  Why is it using eax on
> i386 and not ax or al?  After all we're just putting an unsigned
> char in it.  Why is __r and int and not an tsl_t?
> 
> > Should the x86 code get the "volatile"'s too?
> 
> I'm assuming you're talking about the one in MUTEX_UNSET?  I have
> no idea where that volatile comes from, but it seems to be used on
> other arches too.
> 
> I don't think it's needed, but it shouldn't be bad either.

At least in theory it is needed. Otherwise gcc could e.g. optimize away
multiple consecutive calls to MUTEX_UNSET without other mutex accesses
in between.


Thiemo