• Simon Feltman's avatar
    Use ffi_call directly instead of g_callable_info_invoke · 5798f94b
    Simon Feltman authored
    Cleanup internal callable cache and state tracking by removing multiple
    counting schemes for differently sized "in" and "out" argument arrays.
    Use a single count based on the total number of arguments passed to C
    (inclusive of instance argument and GError exception where applicable).
    Size all state tracking arrays to the same size and ensure argument cache
    indices always line up with these arrays. This cleans up logic which was
    required by g_callable_info_invoke for splitting "in" and "out" arguments
    up.
    
    Cleanup array marshaling which can now rely on the new scheme which ensures
    the "arg_values" array always points to the correct location for length
    argument values.
    
    Cache the ffi_cif struct in PyGICallableCache via GIFunctionInvoker and
    related GI methods. Overall, these changes can give a performance boost of
    almost 2x for simple function calls (see ticket for micro benchmarks).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723642
    5798f94b
pygi-closure.c 34.9 KB