Change the order of the retain count and the padding, so the retain count is

always the word before isa.

Switch to using the correct kind of alignof (the ABI alignment in structures,
not the preferred alignment of the type - this stops us from allocating 4 bytes
of padding on x86-32 where there is no need for any)



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33642 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
theraven 2011-07-26 20:08:10 +00:00
parent 9c03fb74fb
commit 1d7274697b

View file

@ -398,11 +398,11 @@ static inline NSLock *GSAllocationLockForObject(id p)
#endif #endif
#ifdef ALIGN #ifdef ALIGN
#undef ALIGN #undef ALIGN
#endif #endif
#define ALIGN __alignof__(double) #define alignof(type) __builtin_offsetof(struct { const char c; type member; }, member)
#define ALIGN alignof(double)
/* /*
* Define a structure to hold information that is held locally * Define a structure to hold information that is held locally
@ -419,8 +419,8 @@ typedef struct obj_layout_unpadded {
* structure correct. * structure correct.
*/ */
struct obj_layout { struct obj_layout {
NSUInteger retained;
char padding[ALIGN - ((UNP % ALIGN) ? (UNP % ALIGN) : ALIGN)]; char padding[ALIGN - ((UNP % ALIGN) ? (UNP % ALIGN) : ALIGN)];
NSUInteger retained;
}; };
typedef struct obj_layout *obj; typedef struct obj_layout *obj;