|
infix
A JIT-Powered FFI Library for C
|
Regression test for packed struct layout and by-value returns. More...
#include "common/compat_c23.h"#include "common/double_tap.h"#include "common/infix_internals.h"#include "types.h"#include <infix/infix.h>#include <stddef.h>#include <stdint.h>#include <string.h>Classes | |
| struct | packed_char_int |
| struct | packed_char_u64 |
| struct | packed_int_char_int |
| struct | packed_mixed |
Macros | |
| #define | DBLTAP_IMPLEMENTATION |
Functions | |
| PackedABC | return_packed_abc (void) |
| PackedTiny | return_packed_tiny (void) |
| PackedSix | return_packed_six (void) |
| static infix_type * | create_packed_abc_type (infix_arena_t *arena) |
| static infix_type * | create_packed_tiny_type (infix_arena_t *arena) |
| static infix_type * | create_packed_six_type (infix_arena_t *arena) |
| subtest ("Parsed !{char,int} -- size and offsets") | |
| subtest ("Parsed !{char,uint64_t} -- size and offsets") | |
| subtest ("Parsed !{int,char,int} -- three members") | |
| subtest ("Parsed !{char,short,int,longlong} -- mixed types") | |
| subtest ("Print roundtrip for packed struct") | |
| subtest ("By-value return -- PackedABC (9 bytes)") | |
| subtest ("By-value return -- PackedTiny (3 bytes)") | |
| subtest ("By-value return -- PackedSix (6 bytes)") | |
Variables | |
| TEST | |
Regression test for packed struct layout and by-value returns.
Verifies that packed structs parsed via infix_type_from_signature (the !{...} syntax) produce correct member offsets and total sizes through the _layout_struct code path. Also verifies that packed structs with non-power-of-2 sizes are correctly returned by value through forward trampolines.
On AAPCS64, structs <= 16 bytes are returned in X0 (bytes 0-7) and X1 (bytes 8-15). The forward trampoline epilogue must decompose the return buffer write into correct sub-register stores for each chunk. Prior to the fix, sizes other than {1, 2, 4, 8, 16} hit default: break; and wrote zero bytes.
| #define DBLTAP_IMPLEMENTATION |
|
static |
|
static |
|
static |
| PackedABC return_packed_abc | ( | void | ) |
| PackedSix return_packed_six | ( | void | ) |
| PackedTiny return_packed_tiny | ( | void | ) |
| subtest | ( | "By-value return -- PackedABC (9 bytes)" | ) |
| subtest | ( | "By-value return -- PackedSix (6 bytes)" | ) |
| subtest | ( | "By-value return -- PackedTiny (3 bytes)" | ) |
| subtest | ( | "Parsed !{char,int} -- size and offsets" | ) |
| subtest | ( | "Parsed !{char,short,int,longlong} -- mixed types" | ) |
| subtest | ( | "Parsed !{char,uint64_t} -- size and offsets" | ) |
| subtest | ( | "Parsed !{int,char,int} -- three members" | ) |
| subtest | ( | "Print roundtrip for packed struct" | ) |