digitalmars.D - [SAoC 2021] Replace druntime Hooks with Templates: Milestone 4, Week 1
- Teodor Dutu (23/23) Dec 24 2021 Hi,
- max haughton (5/29) Dec 24 2021 The frontend inliner leads to such strange issues that I think we
Hi, This milestone I am planning to finish replacing the hooks to `_d_arrayappend{T,cTX}` with templates. This week I almost finished this task. There is still a bug when inlining a function such as: ```d int[] arr; void foo() { (arr ~= 2) ~= 1; } ``` The first concatenation causes an `ArrayIndexError` because the location of the array length is incorrectly referred in the resulting executable. I am yet to find the source of this error. I dissected inline.d, and the resulting statement looks alright. After this, I plan to convert `_d_newThrowable` and `_d_newitem{U,iT,T}` to templates. I started working on `_d_newThrowable`, but I'm having trouble recreating [these `assert`s](https://github.com/dlang/druntime/blob/fd9a45448244fb9dd4326520ad8526c540895eb0/src/r /ehalloc.d#L35-L36) as the template doesn't store those flags. Merry Christmas! Thanks, Teodor
Dec 24 2021
On Friday, 24 December 2021 at 18:59:07 UTC, Teodor Dutu wrote:Hi, This milestone I am planning to finish replacing the hooks to `_d_arrayappend{T,cTX}` with templates. This week I almost finished this task. There is still a bug when inlining a function such as: ```d int[] arr; void foo() { (arr ~= 2) ~= 1; } ``` The first concatenation causes an `ArrayIndexError` because the location of the array length is incorrectly referred in the resulting executable. I am yet to find the source of this error. I dissected inline.d, and the oddresulting statement looks alright. After this, I plan to convert `_d_newThrowable` and `_d_newitem{U,iT,T}` to templates. I started working on `_d_newThrowable`, but I'm having trouble recreating [these `assert`s](https://github.com/dlang/druntime/blob/fd9a45448244fb9dd4326520ad8526c540895eb0/src/r /ehalloc.d#L35-L36) as the template doesn't store those flags. Merry Christmas! Thanks, TeodorThe frontend inliner leads to such strange issues that I think we should delete it and use something in the backend instead. As far as I'm aware Walter has one in DMC, but it doesn't have a heuristic so it's only if you ask for inlining explicitly.
Dec 24 2021