This change is *wrong*. It won't guarantee the correct alignment!!!
- Thomas
dgorbachev@svn.reactos.org wrote:
Author: dgorbachev Date: Tue Apr 24 02:06:34 2007 New Revision: 26482
URL: http://svn.reactos.org/svn/reactos?rev=26482&view=rev Log: Use allocation function instead of hack, save 12 bytes.
Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
Modified: trunk/reactos/ntoskrnl/include/internal/ex.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/e... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ex.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ex.h Tue Apr 24 02:06:34 2007 @@ -102,22 +102,13 @@ #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
-// -// Broken GCC with Alignment Bug. We'll do alignment ourselves at higher cost. -// -#define DEFINE_WAIT_BLOCK(x) \
- struct _AlignHack \
- { \
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);+#ifdef __GNUC__
+#define DEFINE_WAIT_BLOCK(x) \
- PEX_PUSH_LOCK_WAIT_BLOCK x = __builtin_alloca(sizeof(EX_PUSH_LOCK_WAIT_BLOCK));
#else
// @@ -125,8 +116,8 @@ // local variable (the actual pointer) away, so we don't take any perf hit // by doing this. // -#define DEFINE_WAIT_BLOCK(x) \
- EX_PUSH_LOCK_WAIT_BLOCK WaitBlockBuffer; \
+#define DEFINE_WAIT_BLOCK(x) \
- EX_PUSH_LOCK_WAIT_BLOCK WaitBlockBuffer; \ PEX_PUSH_LOCK_WAIT_BLOCK x = &WaitBlockBuffer;
#endif @@ -725,7 +716,7 @@ if (InterlockedBitTestAndSet((PLONG)PushLock, EX_PUSH_LOCK_LOCK_V)) { /* Someone changed it, use the slow path */
DbgPrint("%s - Contention!\n", __FUNCTION__);
}// DbgPrint("%s - Contention!\n", __FUNCTION__); ExfAcquirePushLockExclusive(PushLock);@@ -763,7 +754,7 @@ if (ExpChangePushlock(PushLock, NewValue.Ptr, 0)) { /* Someone changed it, use the slow path */
DbgPrint("%s - Contention!\n", __FUNCTION__);
}// DbgPrint("%s - Contention!\n", __FUNCTION__); ExfAcquirePushLockShared(PushLock);@@ -977,7 +968,7 @@ OldValue.Ptr)) { /* We have waiters, use the long path */
DbgPrint("%s - Contention!\n", __FUNCTION__);
}// DbgPrint("%s - Contention!\n", __FUNCTION__); ExfReleasePushLock(PushLock);}