The document that you want to read is the System V ABI for x86-64, in particular, section 3.2.3
?Paramater Passing?
Structs that are > 32 bytes, go always on the stack.
For structs that are <= 32 bytes, there is some logic going on:
The post merger cleanup says that given that the size is greater than 2 eighbytes (16 bytes), and the first parameter is not an SSE, or any other parameter is not SSEUP, the whole aggregate is classified as MEMORY (stack).
Regarding the use of std::function
, there is one last rule that might explain it:
- If a C++ object has either a non-trivial copy constructor or a non-trivial destructor, it is passed by invisible reference (the
object is replaced in the parameter list by a pointer that has class
INTEGER)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…