Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 92b2c13

Browse files
committed
Declare lwlock.c's LWLockAcquireCommon() as a static inline.
68a2e52 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().
1 parent ae70b9f commit 92b2c13

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/storage/lmgr/lwlock.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ static LWLock *held_lwlocks[MAX_SIMUL_LWLOCKS];
8585
static int lock_addin_request = 0;
8686
static bool lock_addin_request_allowed = true;
8787

88-
static bool LWLockAcquireCommon(LWLock *l, LWLockMode mode, uint64 *valptr,
89-
uint64 val);
88+
static inline bool LWLockAcquireCommon(LWLock *l, LWLockMode mode,
89+
uint64 *valptr, uint64 val);
9090

9191
#ifdef LWLOCK_STATS
9292
typedef struct lwlock_stats_key
@@ -478,7 +478,7 @@ LWLockAcquireWithVar(LWLock *l, uint64 *valptr, uint64 val)
478478
}
479479

480480
/* internal function to implement LWLockAcquire and LWLockAcquireWithVar */
481-
static bool
481+
static inline bool
482482
LWLockAcquireCommon(LWLock *l, LWLockMode mode, uint64 *valptr, uint64 val)
483483
{
484484
volatile LWLock *lock = l;

0 commit comments

Comments
 (0)