The GNU Objective-C runtime and compiler have been enhanced to support the Boehm's garbage collector. To gain speed and to be able to implement some special facilities like weak pointers (pointers that are invisible to the garbage collector), the GNU Objective-C runtime uses typed memory to allocate all the instances of the classes.
The typed memory descriptor for each class is computed once per class, immediately after the object has been initialized. The descriptor is computed from the information about instance variables available in the class. To correctly handle all the type information, the Objective-C encoding for bitfields has been changed to include description of the type holding the bitfield and the position of the bitfield inside the corresponding value.
To mark a pointer inside an instance as a weak pointer, the function
class_ivar_set_gcinvisible() from the GNU runtime should be
used. This function takes as argument the class whose instances contain
the weak pointer, the name of the instance variable and a boolean flag
that marks or unmarks the instance variable as a weak pointer.
See the documentation in the GNU Objective-C compiler for a description
of the new encoding of bitfields and for an example of the
class_ivar_set_gcinvisible() function.
Go to the first, previous, next, last section, table of contents.