Thanks. That's good to know. At the moment a fix to NSAllocateObject will solve 
my problem, but one may never know, I could end up with structures requiring 16 
bytes alignments in any objects. (btw, this is coming from intrinsic accessing 
SSE2 registers). 

Thanks for looking into this!

--
  Laurent

On Jul 6, 2013, at 3:58 AM, Richard Frith-Macdonald 
<[email protected]> wrote:

> 
> On 5 Jul 2013, at 14:41, Laurent Michel <[email protected]> wrote:
> 
>> Ok, so that's a bug then. On x64, one should add 8 bytes of padding before 
>> (or after) the counter in front of any NSObject to preserve a clean 
>> alignment. 
> 
> NSAllocateObject() already contained code to do that, but was getting it 
> wrong using the alignment of double.
> With gcc it can use __BIGGEST_ALIGNMENT__ to get the right calculation, but 
> that's not available with clang.
> So I changed the code in svn trunk to always use 16 if we are compiling with 
> clang.
> 
> If anyone knows a clang equiivalent of __BIGGEST_ALIGNMENT__, we could/should 
> change to use it, since using 16 may waste space on some architectures and 
> may not be enough on others (though I know of none).
> 
> PS. this is for NSAllocateObject() ... if you call class_createInstance() 
> then the runtime will probably not provide the required padding :-(
> 
> However, if you are using the old runtime, the compatibility layer in 
> gnustep-base now implements  class_createInstance() by calling 
> NSDAllocateObject(), so in this case it should be safe to use that runtime 
> function.
> 
> 

_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to