[Issue 16098] align(N) not respected for stack variables if N > platform stack alignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 23 21:16:12 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=16098

--- Comment #8 from Walter Bright <bugzilla at digitalmars.com> ---
Increasing the alignment has some problems:

1. won't fit with the C ABI. I.e. if other functions are not following those
alignments, and you call them from D and pass a callback, the callback won't be
aligned. Or if the C functions call D functions, no alignment.

2. alignment requirements for some SIMD instructions keeps getting bigger and
bigger. Increasing the alignment for functions is not very future proof.

3. larger alignments are rare. But increasing the alignment means it is done
for every function making for a lot more stack space being used.

But, it turns out that the code in DMD to do closures is almost exactly what we
need for implementing an "aligned closure" allocated on the stack.

The code generator doesn't need to be touched.

--


More information about the Digitalmars-d-bugs mailing list