Plan for D

Dukc ajieskola at gmail.com
Tue May 18 08:01:55 UTC 2021


On Monday, 17 May 2021 at 08:32:16 UTC, sighoya wrote:
> Just a question, is anything about the GC part of the language 
> spec of D?
> Is it possible to introduce a task local GC to D in another 
> compiler without to touch the D language?

The spec assumes GC exists if you use some features - `new`, 
`arr1 ~ arr2` or associative arrays.

However, the GC is implemented in DRuntime. At least in theory, 
you could take another garbage collector and recompile DRuntime 
so it uses the foreign collector instead.

However, if write barriers are needed, you probably need to use 
some sort of bytecode tool to insert them to an already compiled 
object file, and that means `malloc`ed memory access also gets 
write barriers. Regular D code considers manually allocated code, 
static buffers and gc-allocated memory to be all the same type, 
handled with the same functions.


More information about the Digitalmars-d mailing list