infix
A JIT-Powered FFI Library for C
|
Tests passing and returning aggregates that are handled by reference. More...
Macros | |
#define | DBLTAP_IMPLEMENTATION |
Functions | |
int | process_large_struct (LargeStruct s) |
Processes a large struct, returning a value derived from its members. | |
LargeStruct | return_large_struct (int base_val) |
Returns a large struct by value, which the ABI turns into a hidden pointer return. | |
int | process_npot_struct (NonPowerOfTwoStruct s) |
subtest ("Large struct (>16 bytes) passed and returned by reference/stack") | |
subtest ("Non-power-of-two sized struct") | |
Variables | |
TEST | |
Tests passing and returning aggregates that are handled by reference.
Copyright (c) 2025 Sanko Robinson
This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.
SPDX-License-Identifier: (Artistic-2.0 OR MIT)
The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
SPDX-License-Identifier: CC-BY-4.0
This test suite focuses on aggregates that are too large to be passed entirely in registers. According to most ABIs, such structs are either passed as a pointer to a copy on the stack (by reference) or directly on the stack. When returned, a hidden pointer to a caller-allocated buffer is often used. This suite verifies these mechanisms.
It covers two main scenarios:
#define DBLTAP_IMPLEMENTATION |
int process_large_struct | ( | LargeStruct | s | ) |
Processes a large struct, returning a value derived from its members.
int process_npot_struct | ( | NonPowerOfTwoStruct | s | ) |
LargeStruct return_large_struct | ( | int | base_val | ) |
Returns a large struct by value, which the ABI turns into a hidden pointer return.
subtest | ( | "Large struct (>16 bytes) passed and returned by reference/stack" | ) |
subtest | ( | "Non-power-of-two sized struct" | ) |