low-latency GC

Max Haughton maxhaton at gmail.com
Sun Dec 6 11:27:39 UTC 2020


On Sunday, 6 December 2020 at 11:07:50 UTC, Ola Fosheim Grostad 
wrote:
> On Sunday, 6 December 2020 at 10:44:39 UTC, Max Haughton wrote:
>> On Sunday, 6 December 2020 at 05:29:37 UTC, Ola Fosheim 
>> Grostad wrote:
>> It has to be either some kind of heavily customisable small GC 
>> (i.e. with our resources the GC cannot please everyone), or 
>> arc. The GC as it is just hurts the language.
>>
>> Realistically, we probably need some kind of working group or 
>> at least serious discussion to really narrow down where to go 
>> in the future. The GC as it is now must go, we need borrowing 
>> to work with more than just pointers, etc.
>>
>> The issue is that it can't just be done incrementally, it 
>> needs to be specified beforehand.
>
> ARC can be done incrementally, we can do it as a library first 
> and use a modified version existing GC for detecting failed 
> borrows at runtime during testing.
>
> But all libraries that use owning pointers need ownership to be 
> made explicit.
>
> A static borrow checker an ARC optimizer needs a high level IR 
> though. A lot of work though.

ARC with a library will have overhead unless the compiler/ABI is 
changed e.g. unique_ptr in C++ has an indirection.

The AST effectively is a high-level IR. Not a good one, but good 
enough. The system Walter has built shows the means are there in 
the compiler already.

As things are at the moment, the annotations we have for pointers 
like scope go a long way, but the language doesn't deal with 
things like borrowing structs (and the contents of structs i.e. 
making a safe vector) properly yet. That is what needs thinking 
about.


More information about the Digitalmars-d-learn mailing list