Garbage Collection for Systems Programmers

H. S. Teoh hsteoh at qfbox.info
Tue Apr 2 15:31:25 UTC 2024


On Wed, Apr 03, 2024 at 03:50:19AM +1300, Richard (Rikki) Andrew Cattermole via Digitalmars-d wrote:
> On 03/04/2024 2:23 AM, Guillaume Piolat wrote:
> > If you want to use GC and be portable, then (currently in D today)
> > you have to write your own D runtime. Of which there is 3 or 4
> > custom ones!
> 
> And worse still they each have to implement the compiler hooks, when
> all they really need to implement is stuff like allocation of memory!
> 
> Locking people into a specific compiler version makes peoples lives
> harder than it needs to be.
> 
> Split the hooks out, into a compiler adjacent library with a well
> defined API for runtimes to implement will make custom runtime writers
> lives a lot easier.

Yes, undocumented compiler hooks are a big barrier to adaptability. This
needs to be refactored.  Right now there are tons of undocumented
conventions and hooks that you basically have to do trial-and-error to
discover.  This needs to be documented and refactored to a proper API
instead.


> It'll also mean faster builds since less stuff is in object.d so lots
> of wins here.

Yeah while getting my D code to run in wasm, I discovered that there's a
lot of stuff in object.d that actually only matters to druntime backend
code. Would be nice to get rid of this stuff.

Though tbh you probably won't see very much improvement in build times
here; object.d is pretty low down on the list of druntime/phobos modules
that hog compile time. The gains probably won't be noticeable in
non-trivial projects.


T

-- 
Two wrongs don't make a right; but three rights do make a left...


More information about the Digitalmars-d mailing list