Unit test for passing and returning large aggregates by reference.
This test file validates the ABI implementation for handling aggregates (structs) that are too large to be passed or returned directly in registers. According to most ABIs (including System V and Windows x64), such aggregates are handled "by reference."
- Passing by Reference: The caller allocates memory for the struct, and a pointer to this memory is passed in a general-purpose register.
- Returning by Reference: The caller allocates space for the return value and passes a hidden pointer to this space as the first (often invisible) argument to the function. The callee then writes its result to this location.
This test verifies both scenarios for:
- A
LargeStruct (24 bytes), which is guaranteed to be passed by reference.
- A
NonPowerOfTwoStruct (12 bytes), which is also passed by reference on many ABIs (like Windows x64) that have strict size rules for register passing.