|
double | sum_max_reg_doubles (double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8) |
| Sums the maximum number of doubles that can fit in registers for the target ABI.
|
|
double | sum_one_stack_double (double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9) |
| Sums one more double than can fit in registers, forcing one onto the stack.
|
|
double | large_stack_callee (ARGS_0_TO_99, ARGS_100_TO_499, ARGS_500_TO_519) |
| A function with 520 arguments to test massive stack frames.
|
|
int | many_args_callback_handler (int a, double b, int c, const char *d, Point e, float f) |
| A callback handler that takes a mix of register and stack arguments.
|
|
void | execute_many_args_callback (int(*func_ptr)(int, double, int, const char *, Point, float)) |
| A harness to call the generated callback with many arguments.
|
|
| subtest ("Forward calls with register and stack arguments") |
|
| subtest ("Reverse call (callback) with stack arguments") |
|
Tests FFI calls with a large number of arguments, forcing stack usage.
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 is designed to stress-test the ABI implementation when the number of arguments exceeds the number of available parameter registers. It verifies correct stack layout, alignment, and argument marshalling for both forward and reverse FFI calls.
It covers several key scenarios:
- Forward Call (Register Limit): A function is called with the exact number of arguments to fill all available parameter registers, testing this important boundary condition.
- Forward Call (One on Stack): A function is called with one more argument than fits in registers, testing the transition to stack-based passing.
- Forward Call (Massive Stack): A function with over 500 arguments is called, verifying the library's ability to handle stack frames larger than a single memory page and exercising the bulk-copy optimization for homogeneous stack arguments.
- Reverse Call (Callback): A callback is created for a handler with a mixed set of arguments that will spill onto the stack, ensuring the JIT stub can correctly retrieve arguments from both registers and the caller's stack frame.