Reimplementing software building blocks like malloc and free in D

Mike Franklin slavo5150 at yahoo.com
Mon Aug 13 01:49:35 UTC 2018


On Sunday, 12 August 2018 at 06:35:17 UTC, Eugene Wissner wrote:

> P.S. In the last weeks I had thoughts to split low-level stuff 
> from tanya and put it into a separate library, kind of native, 
> gc-free x86-64 (and maybe aarch64) Linux runtime for D. 
> Probably I should go for it :)

In recent months, I've been thinking about something like that as 
well.

As I work to improve implementations in DMD and DRuntime, I'm 
always running into situations where I need utility functions or 
other convenience implementations that currently exists in 
Phobos, but I can't use Phobos in DMD or DRuntime.  I'd like to 
have a small dependency-less library that has implementations 
that don't require much of a runtime implementation (just 
depending on the language itself), so it can actually be used to 
create the DRuntime implementations.  These include things type 
conversion, formatted IO, compile-time type information like that 
found in std.traits and std.meta, and generally useful algorithms 
like those in std.algorithm.  It might even be quite nice to have 
some features from `std.experimental.allocator` available for 
implementing memory allocation in Druntime.

I started explore this idea with 
https://github.com/JinShil/utiliD, but found that the Phobos 
implementations are so interconnected, it's quite a burden to 
decouple them.  That, and I began encountering chicken-and-egg 
issues with DRuntime implementations.  There was a discussion 
recently about refactoring out the compiler dependencies from the 
platform dependencies in DRuntime 
(https://forum.dlang.org/post/pjqepc$2sfv$1@digitalmars.com), and 
I think that will have to be done first before continuing with 
the idea.

Mike


More information about the Digitalmars-d mailing list