Re: [HACKERS] configure on linux

Tom Ivar Helbekkmo <tih@hamartun.priv.no>

From: Tom I Helbekkmo <tih@Hamartun.Priv.NO>
To: Bruce Momjian <maillist@candle.pha.pa.us>
Cc: scrappy@hub.org, goran@bildbasen.se, hackers@postgreSQL.org
Date: 1998-02-05T04:21:12Z
Lists: pgsql-hackers
On Wed, 4 Feb 1998, Bruce Momjian wrote:

> Yes, I considered static functions, but that is assuming the compiler is
> going to do something, and we can't really be sure of this.  Better to
> make it a macro, so there is no change of it not being inlined.  Also, I
> don't think asm stuff is re-ordered, so you don't have the 'volatile'
> problem.

Good thinking.  I think I'll just inline the thing down to this:

#define S_LOCK(addr)		asm("1: bbssi $0,(%0),1b": :"r"(addr))
#define	S_UNLOCK(addr)		(*(addr) = 0)
#define	S_INIT_LOCK(addr)	(*(addr) = 0)

Dropping this into the (simple) test code I was using, it worked right
at all optimization levels -- but how much can the compiler manage to
screw up for me anyway, when there's just one single instruction?  :-)

-tih
-- 
Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"