Re: [HACKERS] configure on linux - Mailing list pgsql-hackers

From Tom I Helbekkmo
Subject Re: [HACKERS] configure on linux
Date
Msg-id 980205045500.7956A@barsoom.Hamartun.Priv.NO
Whole thread Raw
In response to Re: [HACKERS] configure on linux  (Bruce Momjian <maillist@candle.pha.pa.us>)
List 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"


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] Re: regression test "strings" failure.
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] VACUUM ANALYZE Problem