Use allocation function instead of hack, save 12 bytes.

svn path=/trunk/; revision=26482
This commit is contained in:
Dmitry Gorbachev 2007-04-23 22:06:34 +00:00
parent 4684a592f2
commit 1abb769823

View file

@ -102,21 +102,12 @@ typedef struct
#define MAX_HIGH_INDEX (MID_LEVEL_ENTRIES * MID_LEVEL_ENTRIES * LOW_LEVEL_ENTRIES) #define MAX_HIGH_INDEX (MID_LEVEL_ENTRIES * MID_LEVEL_ENTRIES * LOW_LEVEL_ENTRIES)
// //
// Detect GCC 4.1.2+ // Detect GCC
// //
#if 1 // (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40102 #ifdef __GNUC__
//
// Broken GCC with Alignment Bug. We'll do alignment ourselves at higher cost.
//
#define DEFINE_WAIT_BLOCK(x) \ #define DEFINE_WAIT_BLOCK(x) \
struct _AlignHack \ PEX_PUSH_LOCK_WAIT_BLOCK x = __builtin_alloca(sizeof(EX_PUSH_LOCK_WAIT_BLOCK));
{ \
UCHAR Hack[15]; \
EX_PUSH_LOCK_WAIT_BLOCK UnalignedBlock; \
} WaitBlockBuffer; \
PEX_PUSH_LOCK_WAIT_BLOCK x = (PEX_PUSH_LOCK_WAIT_BLOCK) \
((ULONG_PTR)&WaitBlockBuffer.UnalignedBlock &~ 0xF);
#else #else
@ -725,7 +716,7 @@ ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
if (InterlockedBitTestAndSet((PLONG)PushLock, EX_PUSH_LOCK_LOCK_V)) if (InterlockedBitTestAndSet((PLONG)PushLock, EX_PUSH_LOCK_LOCK_V))
{ {
/* Someone changed it, use the slow path */ /* Someone changed it, use the slow path */
DbgPrint("%s - Contention!\n", __FUNCTION__); // DbgPrint("%s - Contention!\n", __FUNCTION__);
ExfAcquirePushLockExclusive(PushLock); ExfAcquirePushLockExclusive(PushLock);
} }
@ -763,7 +754,7 @@ ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
if (ExpChangePushlock(PushLock, NewValue.Ptr, 0)) if (ExpChangePushlock(PushLock, NewValue.Ptr, 0))
{ {
/* Someone changed it, use the slow path */ /* Someone changed it, use the slow path */
DbgPrint("%s - Contention!\n", __FUNCTION__); // DbgPrint("%s - Contention!\n", __FUNCTION__);
ExfAcquirePushLockShared(PushLock); ExfAcquirePushLockShared(PushLock);
} }
@ -977,7 +968,7 @@ ExReleasePushLock(PEX_PUSH_LOCK PushLock)
OldValue.Ptr)) OldValue.Ptr))
{ {
/* We have waiters, use the long path */ /* We have waiters, use the long path */
DbgPrint("%s - Contention!\n", __FUNCTION__); // DbgPrint("%s - Contention!\n", __FUNCTION__);
ExfReleasePushLock(PushLock); ExfReleasePushLock(PushLock);
} }
} }