[SAOC 2026] DMD CTFE Performance Weekly Update #5

Abul Hossain Khan abulkhan19175 at gmail.com
Thu Nov 5 12:07:02 UTC 2026


Hi everyone,

I had my university exams at the end of October, so I took about 
two weeks off from the project and there was no update. I'm back 
since a few days, and here is what I did in between and what I'm 
doing now.

#### CTFE bug fixes

Before and after the exams I kept going through CTFE bug list, 
and most of the new issues I filed myself while working on his, 
one led to the next.

- Array `==` with struct or class elements ignored the element's 
`opEquals`. Fixed by interpreting the `__equals` lowering that 
semantic already builds, instead of writing equality a third time 
in the interpreter - https://github.com/dlang/dmd/pull/24092
- A `goto` to a label inside a `finally` body was dropped. The 
interpreter doesn't jump, it re-walks the body in a "skip until 
this label" mode, and the finally body had no such loop - 
https://github.com/dlang/dmd/pull/24103
- An exception thrown after a `goto` inside a `try` body was 
never caught - https://github.com/dlang/dmd/pull/24107
- Pointer arithmetic on a pointer to a static array element 
indexed the outer array, because CTFE represents a pointer to 
`m[0]` as a pointer into `m` - 
https://github.com/dlang/dmd/pull/24133
- `p + n` with a negative `n` failed, the offset was treated as 
unsigned - https://github.com/dlang/dmd/pull/24200
- `is` on arrays and AAs compared contents, so `[1] is [1]` was 
true and `new int[0] is null` was false. Now it's by reference 
like at run time - https://github.com/dlang/dmd/pull/24183
- `foreach` over strings let some invalid UTF-16 and invalid code 
points through, and one case crashed the compiler. All errors now 
- https://github.com/dlang/dmd/pull/24155
- `x <<= n` with a count out of range wasn't checked, and 
op-assign on a `__vector` hit an assert - 
https://github.com/dlang/dmd/pull/24199
- `arr && true` with an array, a delegate or an AA failed. The 
optimizer makes a `cast(bool)` for these that can't be written in 
source, and the interpreter had never learned it - 
https://github.com/dlang/dmd/pull/24201
- Not CTFE but found on the way: a 64-bit wide bitfield read 0 
after a struct literal, the backend mask overflowed - 
https://github.com/dlang/dmd/pull/24115

Also one in the perf bot: https://github.com/dlang/dmd/pull/24187


#### The design doc
So I'm writing the design doc for the interface now with where 
the engine plugs in, what it gets and gives back, and what stays 
with the AST interpreter. I'll get it reviewed and then start the 
refactoring.

#### What's next

- Finalize the design doc and get it reviewed.
- The rest of the bug list on the side.

Thanks to Dennis for mentoring this. As always, feel free to 
leave any feedback or suggestions!



More information about the Digitalmars-d mailing list