Matthew N. Dodd writes:
> On Wed, 10 Jun 1998, Bruce Momjian wrote:
> > Quite and analysis. I want to comment on the code more, but I just want
> > to point out now that many of our i386 platforms are not GNU. I think
> > we have to use macros. I can't think of any GNU-specific code in the
> > source tree at this point, and I don't think it makes sense add it now
> > just to make the code look a litter cleaner.
>
> Indeed. Those of use who have thousand dollar SunPro compilers thank you.
>
> (can you say progressive optomizer?)
^^^^^^^^^ uhhh, no. ;-)
Hmmmm, looking at the original code, non-GCC Sparc makes a function call to
the tas() routine which is coded as asm. I have not in fact changed it.
As I understand your comment, you wish this to be a macro.
The code is:
#if defined(NEED_SPARC_TAS_ASM)
/*
* sparc machines not using gcc
*/
static void tas_dummy() /* really means: extern int tas(slock_t *lock); */
{
asm(".seg \"data\"");
asm(".seg \"text\"");
asm("_tas:");
/*
* Sparc atomic test and set (sparc calls it "atomic load-store")
*/
asm("ldstub [%r8], %r8");
asm("retl");
asm("nop");
}
#endif /* NEED_SPARC_TAS_ASM */
I doubt there are any major performance gains to be had here, but I would
be interested to learn otherwise. I don't have access to a Sparc machine
that I can use for this, so if anyone cares to test this implementation and
any others they can think of please post the results.
But I think perhaps we are micro-optimizing here. I only bothered to do
all the i386 flavors because Bruce had some gprof output that suggested
we had a problem (we didn't), and then I just got kinda interested in the
experiment itself.
-dg
David Gould dg@illustra.com 510.628.3783 or 510.305.9468
Informix Software (No, really) 300 Lakeside Drive Oakland, CA 94612
"A week of coding can sometimes save an hour of thought."