[GSoC 2025] Templated Hooks - Weekly Update #10

AlbertG albert.guiman at protonmail.com
Tue Aug 12 09:03:55 UTC 2025


This week I have benchmarked some of the hooks that have been 
templated a while ago by Teo, using LDC. I have published the 
results in an upcoming PR [1].

While performing this benchmarks, I have noticed some regressions 
with `_d_arrayctor` and `_d_newarrayT`. The cause of the 
regression for `_d_arrayctor` was an unoptimal branching 
condition in the hook logic, which prevented it from using 
`memcpy` in some instances [2]. For `_d_newarrayT`, on the other 
hand, the regression is a problem only with LDC, as it still 
makes use of the old TypeInfo-based hook instead of the templated 
one. The solution is not as straightforward as I initially 
thought, because of the extra LLVM GC2Stack pass it performs and 
so I will need to investigate further [3].

Additionally, I have added some missing exception handling in 
`_d_arrayappendT` for postblit exceptions [4], revealing at the 
same time a bug in the postorder traversal of `CatAssignEp` and 
`CatExp` [5].

Finally, I have moved the lowering of `ConstructExp` to a 
dedicated lowering field, eliminating the need for rewriting the 
original expression in `dinterpret.d` and overall making it 
consisten with the other lowered expressions [6].

[1] https://github.com/teodutu/druntime-hooks-benchmarks/pull/9
[2] https://github.com/dlang/dmd/pull/21675
[3] https://github.com/ldc-developers/ldc/pull/4965
[4] https://github.com/dlang/dmd/pull/21701
[5] https://github.com/dlang/dmd/pull/21699
[6] https://github.com/dlang/dmd/pull/21706



More information about the Digitalmars-d mailing list