www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [SAoC 2023] Replace DRuntime Hooks with Templates Weekly Update #1

reply Teodor Dutu <teodor.dutu gmail.com> writes:
Hi,

I started this week debugging [my older PR for converting 
`_d_newarray{U,iT,T}` to two 
templates](https://github.com/dlang/dmd/pull/15299):

- `_d_newarrayT` is the template to which the compiler lowers 
`new A[n]`. It decides how to initialise the elements of the 
array based on their type at compile time.

- `_d_newarrayU` is the generic implementation called by 
`_d_newarrayT`. It is necessary to keep this hook separate 
because other functions such as `dup()` call `_d_newarrayU`. They 
do so because there's no need to initialise the copied array 
since its elements will be copied from the older array.

I couldn't remove the old hooks from `rt/lifetime.d` because 
they're still used by `_d_newarraym{i,}TX`. I'll be able to 
remove the old `_d_newarray*` hooks when I convert `_d_newarraym` 
to templates, hopefully in the following weeks.

I tried updating `dup()` to also use the template `_d_newarrayU`, 
but this resulted in some errors that became difficult to manage 
given the other changes required for this PR. I intend to take 
care of `dup()` after the `_d_newarray{U,iT,T}` hooks are 
converted to templates. Up to now, the latter are passing all 
tests (except for the FreeBSD ones that seem to be broken 
globally) and I'm looking forward to continuing with 
`_d_newarraym*` and `dup()`.

Thanks,
Teodor
Sep 25 2023
next sibling parent reply M.M. <matus email.cz> writes:
On Monday, 25 September 2023 at 10:47:18 UTC, Teodor Dutu wrote:
 Hi,

 I started this week debugging [my older PR for converting 
 `_d_newarray{U,iT,T}` to two 
 templates](https://github.com/dlang/dmd/pull/15299):

 [...]
Good luck! It's good to see a concentrated effort to bring a longer-term project over the line...
Sep 25 2023
parent Teodor Dutu <teodor.dutu gmail.com> writes:
On Monday, 25 September 2023 at 14:28:53 UTC, M.M. wrote:
 Good luck! It's good to see a concentrated effort to bring a 
 longer-term project over the line...
Thanks!
Sep 26 2023
prev sibling parent sighoya <sighoya gmail.com> writes:
On Monday, 25 September 2023 at 10:47:18 UTC, Teodor Dutu wrote:
[...]
Thanks for improving DMD. Wishing you great success.
Sep 27 2023