Backend nearly entirely converted to D

Joakim dlang at joakim.fea.st
Wed Nov 7 08:31:21 UTC 2018


On Tuesday, 6 November 2018 at 22:12:02 UTC, Walter Bright wrote:
> With the recent merging of the last of the big files machobj.d:
>
> https://github.com/dlang/dmd/pull/8911
>
> I'm happy to say we're over the hump in converting the backend 
> to D!

Great! Although I wish it didn't have to be you mostly doing this 
grunt work.

> Remaining files are minor: tk.c, cgen.c, dt.c, fp.c, os.c, 
> outbuf.c, sizecheck.c, strtold.c and mem.c. I'll probably leave 
> a couple in C anyway - os.c and strtold.c. sizecheck.c will 
> just go away upon completion.
>
> Thanks to everyone who helped out with this!
>
> Of course, the code remains as ugly as it was in C. It'll take 
> time to bit by bit refactor it into idiomatic D.

I just benchmarked building the last couple versions of DMD, when 
most of the backend was converted to D, by building them with the 
latest DMD 2.083.0 official release and clang 6.0 in a 
single-core linux/x64 VPS. Here are the times I got, best of 3 
runs for each:

2.081.2 - 11.5s
2.082.1 - 10.5s
2.083.0 - 9.9s
master  - 10.8s

Not quite the gains hoped for, particularly with those last large 
files you just converted to D seemingly slowing compilation down, 
but maybe it will get better with refactoring and when the entire 
backend is compiled at once, rather than the DMD separate 
compilation used now.

> The more immediate benefit is to get rid of all the parallel .h 
> files, which were a constant source of bugs when they didn't 
> match the .d versions.

I was going to ask why you wouldn't need those headers for your 
C/C++ compiler, DMC, but it looks like you've translated that to 
mostly D already:

https://github.com/DigitalMars/Compiler/tree/master/dm/src/dmc


More information about the Digitalmars-d-announce mailing list