|
infix
A JIT-Powered FFI Library for C
|
End-to-end unit test for passing and returning aggregate types (structs). More...
Macros | |
| #define | DBLTAP_IMPLEMENTATION |
Functions | |
| Point | move_point (Point p, double dx, double dy) |
| A C function to be called via a forward trampoline. Takes and returns a struct. | |
| Point | point_callback_handler (Point p) |
| A C handler to be invoked by a reverse trampoline. | |
| void | execute_point_callback (Point(*func_ptr)(Point), Point p) |
| A C "harness" function that simulates a C library calling our JIT-compiled callback. | |
| subtest ("Forward calls with aggregate types (structs)") | |
| subtest ("Reverse calls (callbacks) with aggregate types") | |
Variables | |
| TEST | |
End-to-end unit test for passing and returning aggregate types (structs).
This test verifies that infix can correctly handle FFI calls where structs are passed by value as arguments and/or returned by value. This is a complex scenario that heavily depends on the correctness of both the type layout calculation and the ABI-specific classification and code generation logic.
The test covers:
move_point) that takes a Point struct by value and returns one by value. This is tested with both bound and unbound trampolines.execute_point_callback) calls a JIT-compiled function pointer generated by infix. This callback then invokes a C handler (point_callback_handler) that also takes and returns a Point struct by value.This test serves as a high-level integration test, confirming that all the pieces of the library (parser, type system, ABI classifier, JIT emitter) work together correctly for a common and important use case.
| #define DBLTAP_IMPLEMENTATION |
A C "harness" function that simulates a C library calling our JIT-compiled callback.
A C function to be called via a forward trampoline. Takes and returns a struct.
| subtest | ( | "Forward calls with aggregate types (structs)" | ) |
| subtest | ( | "Reverse calls (callbacks) with aggregate types" | ) |