Thread overview
[SAoC 2023] Replace DRuntime Hooks with Templates Weekly Update #1
Sep 25
M.M.
Sep 27
sighoya
September 25

Hi,

I started this week debugging my older PR for converting _d_newarray{U,iT,T} to two templates:

  • _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

September 25

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:

[...]

Good luck! It's good to see a concentrated effort to bring a longer-term project over the line...

September 26

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!

September 27

On Monday, 25 September 2023 at 10:47:18 UTC, Teodor Dutu wrote:

>

[...]

Thanks for improving DMD.
Wishing you great success.