View source code
Display the source code in dmd/toir.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function dmd.toir.buildAlignSection

Aligned sections are implemented by taking the local variables that need alignment that is larger than the stack alignment. They are allocated into a separate chunk of memory on the stack called an align section, which is aligned on function entry.

void buildAlignSection (
  FuncDeclaration fd,
  ref IRState irs
);

buildAlignSection() inserts code just after the function prolog is complete. It allocates memory for the align closure by making a local stack variable to contain that memory, allocates a local variable (salignSection) to point to it. In VarExp::toElem and SymOffExp::toElem, when referring to a variable that is in an align closure, take the offset from salignSection rather than from the frame pointer. A variable cannot be in both a closure and an align section. They go in the closure and then that closure is aligned.

getEthis() and NewExp::toElem need to use sclosure, if set, rather than the current frame pointer??

Run after buildClosure, as buildClosure gets first dibs on inAlignSection variables

Parameters

NameDescription
fd function in which all this occurs
irs state of the intermediate code generation

Reference

buildClosure() is very similar.

https

//github.com/dlang/dmd/pull/9143 was an incomplete attempt to solve this problem that was merged. It should probably be removed.

Authors

Walter Bright

License

Boost License 1.0