low-latency GC

Ola Fosheim Grostad ola.fosheim.grostad at gmail.com
Sun Dec 6 16:28:38 UTC 2020


On Sunday, 6 December 2020 at 14:11:41 UTC, Max Haughton wrote:
> On Sunday, 6 December 2020 at 11:35:17 UTC, Ola Fosheim Grostad 
> wrote:
>> On Sunday, 6 December 2020 at 11:27:39 UTC, Max Haughton wrote:
>>> [...]
>>
>> No, unique doesnt need indirection, neither does ARC, we put 
>> the ref count at a negative offset.
>>
>> shared_ptr is a fat pointer with the ref count as a separate 
>> object to support existing C libraries, and make weak_ptr easy 
>> to implement. But no need for indirection.
>>
>>> [...]
>>
>> I think you need a new IR, but it does not have to be used for 
>> code gen, it can point back to the ast nodes that represent 
>> ARC pointer assignments.
>>
>> One could probably translate the one used in Rust, even.
>
> https://gcc.godbolt.org/z/bnbMeY

If you pass something as a parameter then there may or may not be 
an extra reference involved. Not specific for smart pointers, but 
ARC optimization should take care of that.



More information about the Digitalmars-d-learn mailing list