discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libobjc2, small objects, and custom allocation


From: Konstantin Osipov
Subject: Re: libobjc2, small objects, and custom allocation
Date: Sat, 30 Jun 2012 00:52:52 +0400

* David Chisnall <theraven@sucs.org> [12/06/30 00:47]:
> Objects must be word aligned.  This is both a requirement for the small 
> object support, and an ABI requirement, as the first instance variable in 
> every word is the class pointer (which, as a pointer, must be word aligned in 
> a structure).  If your custom allocator is not returning word-aligned memory, 
> then you have a bug if you are trying to use it for Objective-C objects.
> 
> There are many things in the compiler that also assume that object allocators 
> return word-aligned memory - if you're breaking this invariant then expect 
> large amounts of pain.

Hello David,

Thank you for explanation.
We are fairly new to Objective C, moving to it from plain C, and
haven't had this problem before.

BTW, I had to tweak libobjc2 source a bit to compile it with gcc on
Linux. The patch fixes INIT_LOCK() compile error when 
_GNU_SOURCE is defined and removes a number of "taking address of
expression of type 'void'" warnings. 

Would you be interested in it? Should I send it to this list?

-- 
http://tarantool.org - an efficient, extensible in-memory data store



reply via email to

[Prev in Thread] Current Thread [Next in Thread]