Compiler implementation of the D programming language.
Produce elem which increments the usage count for a particular line. Used to implement -cov switch (coverage analysis).
Return elem that evaluates to the static frame pointer for function
fd is a member function, the returned expression will compute the value of
fd's 'this' variable. This routine is critical for implementing nested functions.
Initialize the hidden aggregate member, vthis, with the context pointer.
ad.vthis.offset) = this;
Convert intrinsic function to operator. Returns that operator, -1 if not an intrinsic function.
Given an expression e that is an array, determine and set the 'length' variable.
lengthVarSymbol of 'length' variable &e expression that is the array
t1Type of the array
Closures are implemented by taking the local variables that need to survive the scope of the function, and copying them into a gc allocated chuck of memory. That chunk, called the closure here, is inserted into the linked list of stack frames instead of the usual stack frame.
buildClosure() inserts code just after the function prolog is complete. It allocates memory for the closure, allocates a local variable (sclosure) to point to it, inserts into it the link to the enclosing frame, and copies into it the parameters that are referred to in nested functions. In VarExp::toElem and SymOffExp::toElem, when referring to a variable that is in a closure, takes the offset from sclosure rather than from the frame pointer.
getEthis() and NewExp::toElem need to use sclosure, if set, rather than the current frame pointer.
Determine return style of function - whether in registers or through a hidden pointer to the caller's stack.
© 1999–2017 The D Language Foundation
Licensed under the Boost License 1.0.