Closed
Description
Struct arguments whose size is <= 16 bytes generate unnecessary copies. @sivarv categorized the cases below:
The following are the struct passing cases on Amd64 Unix that are of interest:
- struct of size 1,2,4 or 8 in memory/register is getting passed in an arg reg or on stack
- struct of size 3,5,6,7 in memory/register is getting passed in an arg reg or on stack
- struct of size 9-16 bytes in memory is getting passed in two arg registers
- struct of size 9-16 bytes (e.g. SIMD structs Vector3 and Vector4) in a register is getting passed in two arg registers
- struct of size 9-16 bytes in memory/register is getting passed on stack.
In fgMorphArgs, eeGetSystemVAmd64PassStructInRegisterDescriptor
classifies the cases above as register argument except simd from vector<t>
and sets structDesc.passedInRegisters
to true, this always calls fgMakeOutgoingStructArgCopy()
and generates copies.