|
infix
A JIT-Powered FFI Library for C
|
Unit test for passing and returning large aggregates by reference. More...
#include "common/compat_c23.h"#include "common/double_tap.h"#include "types.h"#include <infix/infix.h>Macros | |
| #define | DBLTAP_IMPLEMENTATION |
Functions | |
| int | process_large_struct (LargeStruct s) |
| A C function that takes a large struct, which the ABI will pass by reference. | |
| LargeStruct | return_large_struct (int base_val) |
| A C function that returns a large struct, which the ABI will return by reference. | |
| int | process_npot_struct (NonPowerOfTwoStruct s) |
| A C function that takes a struct whose size is not a power of two. | |
| subtest ("Large struct (>16 bytes) passed and returned by reference/stack") | |
| subtest ("Non-power-of-two sized struct") | |
Variables | |
| TEST | |
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."
This test verifies both scenarios for:
LargeStruct (24 bytes), which is guaranteed to be passed by reference.NonPowerOfTwoStruct (12 bytes), which is also passed by reference on many ABIs (like Windows x64) that have strict size rules for register passing. | #define DBLTAP_IMPLEMENTATION |
| int process_large_struct | ( | LargeStruct | s | ) |
A C function that takes a large struct, which the ABI will pass by reference.
| int process_npot_struct | ( | NonPowerOfTwoStruct | s | ) |
A C function that takes a struct whose size is not a power of two.
| LargeStruct return_large_struct | ( | int | base_val | ) |
A C function that returns a large struct, which the ABI will return by reference.
| subtest | ( | "Large struct (>16 bytes) passed and returned by reference/stack" | ) |
| subtest | ( | "Non-power-of-two sized struct" | ) |