Add spinlock support for Itanium processor with Intel compiler.

Vikram Kalsi
This commit is contained in:
Bruce Momjian 2005-03-10 21:41:01 +00:00
parent 164adc4d39
commit 609e32b929
1 changed files with 17 additions and 2 deletions

View File

@ -66,7 +66,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.133 2004/12/31 22:03:42 pgsql Exp $ * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.134 2005/03/10 21:41:01 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -168,7 +168,7 @@ spin_delay(void)
#endif /* __i386__ || __x86_64__ */ #endif /* __i386__ || __x86_64__ */
#if defined(__ia64__) || defined(__ia64) /* __ia64 used by ICC compiler? */ #if defined(__ia64__) || defined(__ia64)
/* Intel Itanium */ /* Intel Itanium */
#define HAS_TEST_AND_SET #define HAS_TEST_AND_SET
@ -176,6 +176,8 @@ typedef unsigned int slock_t;
#define TAS(lock) tas(lock) #define TAS(lock) tas(lock)
#ifndef __INTEL_COMPILER
static __inline__ int static __inline__ int
tas(volatile slock_t *lock) tas(volatile slock_t *lock)
{ {
@ -189,6 +191,19 @@ tas(volatile slock_t *lock)
return (int) ret; return (int) ret;
} }
#else
static __inline__ int
tas(volatile slock_t *lock)
{
int ret;
ret = _InterlockedExchange(lock,1); /* this is a xchg asm macro */
return ret;
}
#endif
#endif /* __ia64__ || __ia64 */ #endif /* __ia64__ || __ia64 */