Tests reverse trampolines (callbacks) with struct and union arguments/returns.
More...
Tests reverse trampolines (callbacks) with struct and union arguments/returns.
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 is a comprehensive test suite for verifying the reverse FFI (callback) functionality with aggregate types. It covers a wide range of scenarios that are highly dependent on the target platform's ABI rules.
The suite consolidates several previous tests and verifies:
- Small Structs: Passing and returning a
Point
struct, which is small enough to be handled in registers on most platforms.
- Large Structs (Pass by Reference): Passing a
LargeStruct
to a callback, which ABIs will handle by passing a pointer to a copy on the stack.
- Large Structs (Return via Hidden Pointer): Returning a
LargeStruct
from a callback, which ABIs handle by having the caller provide a hidden pointer to a buffer where the result is written.
- ABI-Specific Aggregates (HFA): Passing a
Vector4
struct, which is treated as a Homogeneous Floating-point Aggregate on AArch64.
- Unions: Returning a
Number
union from a callback.