mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Declare lwlock.c's LWLockAcquireCommon() as a static inline.
68a2e52bba
has introduced LWLockAcquireCommon() containing the
previous contents of LWLockAcquire() plus added functionality. The
latter then calls it, just like LWLockAcquireWithVar(). Because the
majority of callers don't need the added functionality, declare the
common code as inline. The compiler then can optimize away the unused
code. Doing so is also useful when looking at profiles, to
differentiate the users.
Backpatch to 9.4, the first branch to contain LWLockAcquireCommon().
This commit is contained in:
parent
5c1faa7ba7
commit
9c4b55db1d
@ -85,8 +85,8 @@ static LWLock *held_lwlocks[MAX_SIMUL_LWLOCKS];
|
|||||||
static int lock_addin_request = 0;
|
static int lock_addin_request = 0;
|
||||||
static bool lock_addin_request_allowed = true;
|
static bool lock_addin_request_allowed = true;
|
||||||
|
|
||||||
static bool LWLockAcquireCommon(LWLock *l, LWLockMode mode, uint64 *valptr,
|
static inline bool LWLockAcquireCommon(LWLock *l, LWLockMode mode,
|
||||||
uint64 val);
|
uint64 *valptr, uint64 val);
|
||||||
|
|
||||||
#ifdef LWLOCK_STATS
|
#ifdef LWLOCK_STATS
|
||||||
typedef struct lwlock_stats_key
|
typedef struct lwlock_stats_key
|
||||||
@ -510,7 +510,7 @@ LWLockAcquireWithVar(LWLock *l, uint64 *valptr, uint64 val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* internal function to implement LWLockAcquire and LWLockAcquireWithVar */
|
/* internal function to implement LWLockAcquire and LWLockAcquireWithVar */
|
||||||
static bool
|
static inline bool
|
||||||
LWLockAcquireCommon(LWLock *l, LWLockMode mode, uint64 *valptr, uint64 val)
|
LWLockAcquireCommon(LWLock *l, LWLockMode mode, uint64 *valptr, uint64 val)
|
||||||
{
|
{
|
||||||
volatile LWLock *lock = l;
|
volatile LWLock *lock = l;
|
||||||
|
Loading…
Reference in New Issue
Block a user