[fpc-devel] Proof of Concept ARC implementation

Sven Barth pascaldragon at googlemail.com
Fri Oct 31 15:30:30 CET 2014


Am 31.10.2014 06:05 schrieb "Hans-Peter Diettrich" <DrDiettrich1 at aol.com>:
>
> Sven Barth schrieb:
>
>> On 30.10.2014 04:14, Hans-Peter Diettrich wrote:
>
>
>>> I wonder how difficult it would be to implement the existing Interface
>>> refcounting model for TObject, so that this runtime variation could be
>>> tested and benchmarked as well, in addition to the current compiletime
>>> approach. According to the problems of the compiletime approach,
>>> revealed in this thread, it looks not viable to me at all.
>>
>>
>> The code would mostly be the same as the one I already implemented. Add
"virtual" to the ARCDecRef, ARCIncRef and ARCRefCount methods of TObject,
adjust the RTL helper functions to not expect a refcount field at a
specific offset, remove the restrictions that reference counting is only
done for classes marked as "refcounted" and you're done...
>
>
> Looks quite easy :-)
>
> Could you introduce this feature into your branch, by conditional
compilation?

When I find the time I'll try.

>
>
> Mark just pointed me to another problem, possibly unhandled yet.
Interface refcounting must be updated, as soon as the underlying object
becomes refcounted as well. Do you already have an idea how to handle
refcounting for classes with interfaces?

Simply implement the AddRef and Release methods using ARCIncRef and
ARCDecRef and return ARCRefCount.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20141031/7847b7ca/attachment.html>


More information about the fpc-devel mailing list