D Language Foundation March 2023 Monthly Meeting Summary

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Wed Apr 12 01:02:22 UTC 2023


> Finally, he asked what everyone thought about including Phobos in the 
> dmd/druntime mono repository. He said he'd seen no good reason not to 
> [in the forum thread he'd 
> started](https://forum.dlang.org/thread/kdgcznersjetunkvorzh@forum.dlang.org). Iain said that from his perspective, DRuntime and Phobos are the same thing anyway. Mathias voiced support for it. Robert said that if it happened, the first thing he'd do is replace some instances of `filter` with the Phobos version, as he thinks we should be using Phobos in DMD anyway. (Note that no final decision was made here.)

When I type dmd into my browsers search bar this is what it suggests:

dmd/druntime at master · dlang/dmd · GitHub

Not very compiler related now is it ;)

> __Template lowerings in CTFE__
> 
> One problem he'd discovered was that the semantic routines take several 
> constructs and lower them to templates. They do that even when running 
> in CTFE. Those templates can generate a lot of bloat. In CTFE, it should 
> not do the lowering. CTFE finds it much easier to interpret the 
> higher-level code. Upon investigation, he found that CTFE reverses some 
> of the lowerings so that it can interpret them. If you're doing certain 
> things in CTFE like array concatenation, you're suffering from a lot of 
> invisible template bloat. That needs to be fixed. He was about halfway 
> through it. He was looking at all the lowerings and rewriting them so 
> that the lowering isn't done in CTFE. He hopes that this is another step 
> in reducing the problems with memory consumption and slow CTFE speeds. 
> He also hoped to be able to remove the "lowering unwinding" that goes on 
> in the interpreter.
> 
> Iain noted that in [the PR rewriting the  `_d_newclass` runtime hook to 
> a 
> template](https://forum.dlang.org/post/fmzqqpzrzhoheyluelzv@forum.dlang.org), he'd noticed the same thing Walter had just described. He got the author to change things such that rather than doing this lowering->unlowering->relowering thing, the rewrite is put into a field called `lowering`, leaving the original node intact. When you go through CTFE, you just work on that node specifically. Then once you're in codegen, you hit that node and go into the `lowering` field. Walter said that wasn't done with the other rewrites, but Teodor Dutu and Razvan plan to go back and change them (here's [an example of work done toward that end](https://github.com/dlang/dmd/pull/14985)). Walter said this will also be a big win for allowing more expansive use of CTFE in BetterC.

Good to see my priority two for the year is getting some work done 
towards it by happenstance.

Now, if only we could get a compiler adjacent library to contain the 
hooks so nobody writing custom runtimes has to write them moving 
forward... That and getting them all in the same place has other 
benefits like faster compiles!


More information about the Digitalmars-d-announce mailing list