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:
David Chisnall 2011-07-26 20:08:10 +00:00
parent 7698b8d176
commit 48e1b94ef8

View file

@ -398,11 +398,11 @@ static inline NSLock *GSAllocationLockForObject(id p)
#endif
#ifdef ALIGN
#undef ALIGN
#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
@ -419,8 +419,8 @@ typedef struct obj_layout_unpadded {
* structure correct.
*/
struct obj_layout {
NSUInteger retained;
char padding[ALIGN - ((UNP % ALIGN) ? (UNP % ALIGN) : ALIGN)];
NSUInteger retained;
};
typedef struct obj_layout *obj;