|
| double | sum_max_reg_doubles (double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8) |
| | A function that takes the maximum number of doubles that can fit in registers.
|
| |
| double | sum_one_stack_double (double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9) |
| | A function that takes just enough doubles to force one onto the stack.
|
| |
| double | large_stack_callee (ARGS_0_TO_99, ARGS_100_TO_499, ARGS_500_TO_519) |
| |
| int | many_args_callback_handler (int a, double b, int c, const char *d, Point e, float f) |
| | A type-safe handler for a reverse call with mixed register and stack arguments.
|
| |
| void | execute_many_args_callback (int(*func_ptr)(int, double, int, const char *, Point, float)) |
| | A C harness to call the JIT-compiled reverse trampoline.
|
| |
| | subtest ("Forward calls with register and stack arguments") |
| |
| | subtest ("Reverse call (callback) with stack arguments") |
| |
Unit test for FFI calls with a large number of arguments passed on the stack.
This test file is a stress test for the ABI implementation's handling of the stack. Modern calling conventions pass the first several arguments in registers, but all subsequent arguments are passed on the stack. This test verifies that infix can correctly handle both scenarios.
It covers:
- Register-Only Calls: A call is made with the maximum number of arguments that can fit in registers, ensuring the register-passing logic is correct.
- One Stack Argument: A call is made with just enough arguments to force one argument to be placed on the stack, verifying the transition from registers to the stack.
- Large Stack Allocation (>4KB): A call is made with a very large number of arguments (520 doubles), forcing the JIT-compiled trampoline to allocate a significant amount of stack space (>4KB). This is a regression test for bugs where stack offsets were calculated incorrectly for large frames, and it stress-tests the stack allocation and argument marshalling logic.
- Reverse Calls with Stack Arguments: A reverse trampoline is created for a function with enough arguments to require some to be passed on the stack. This verifies that the reverse call stub can correctly retrieve arguments from the caller's stack frame in addition to registers.