Garbage Collection for Systems Programmers

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Apr 9 17:03:46 UTC 2024


On 10/04/2024 4:41 AM, Walter Bright wrote:
> On 4/8/2024 5:47 PM, Richard (Rikki) Andrew Cattermole wrote:
>>> Consider the performance deficit from write-barriers.
>>
>> D is in an excellent position to make write barriers opt-in, with 
>> different strategies allowing for different GC designs.
> 
> It would be a massive bifurcation of the language. It affects 
> everything. Languages that use this tend to have a lot of low-level C 
> systems code, because those languages are not systems implementation 
> languages. Trying to mix code that does and does not do write gates will 
> be very tedious and error prone in hard-to-detect ways.

Yes it could do that.

We would need to set a flag for this in ModuleInfo to detect when a 
binary isn't compiled with write barriers. Given a specific strategy.

But even then it's only going to be a partial solution.

You can only turn on write barriers if you know your program can make 
use of them safely.

I am in no way suggesting we make this opt-out.

Making this opt-in gives us a ton of room for some PhD students to 
research, write papers ext. and hopefully come up with something that'll 
keep people happy that could benefit some extra work on their part.

It's good to remember that just because write barriers are codegen'd in, 
they may be no-op if the GC is StW. So it isn't end of the world. 
Depends upon the write barrier strategy.


More information about the Digitalmars-d mailing list