SerpentOS departs from Dlang

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sun Sep 17 00:55:22 UTC 2023


On 17/09/2023 11:46 AM, Adam Wilson wrote:
> Kidding aside. If you do this, you might as well turn them on 
> everywhere. After that it's a easy stroll to a non-blocking moving GC, 
> which would end most complaints about the GC (nobody complains about the 
> .NET GC anymore).

The scope of each doesn't match up, and you'd still need the RC specific 
write barriers.

So when I say write barrier what I mean is:

```d
class MyRoot : void {
	void opRCWriteBarrier(size_t fieldOffset, void* pointer) {
		myCyclicDetector.set(cast(void*)this, fieldOffset, pointer);
	}

	void opRCSub() {
		if (atomicOp!"-="(this.refCount, 1) > 0)
			myCyclicDetector.collect(cast(void*)this);
	}
}

class Child : MyRoot {
	Array!int array;

	void func() {
		array = new Array!int();
		// this.opRCWriteBarrier(array.offsetof, cast(void*)array);
	}
}
```

Only needs to support classes + structs (I think), so its surface area 
is pretty small.

Oh and Walter has approved anyone to experiment with write barriers ages 
ago, although nobody has.


More information about the Digitalmars-d-announce mailing list