summaryrefslogtreecommitdiffstats
path: root/filter.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-24 07:01:45 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-24 07:01:45 -0700
commit7de278b7c2971aef308ba43b786571fc1739aa00 (patch)
tree21e7481da7439bd8315ea4fc0d5fc114d2ba1ff5 /filter.h
parent4cd1bf6f9fd47275e409d865c1f1c080f9e0c3ec (diff)
downloadtxr-7de278b7c2971aef308ba43b786571fc1739aa00.tar.gz
txr-7de278b7c2971aef308ba43b786571fc1739aa00.tar.bz2
txr-7de278b7c2971aef308ba43b786571fc1739aa00.zip
ffi: elide useless by-value in calls.
We can avoid calling in methods in the by-value nuance (copy == 0) on types known not to have by-value in semantics. Basic types have no by-value in. Pointers inherently have by-value in. An aggregate has by-value in semantics if any of one of its members does, otherwise not. * ffi.c (struct txr_ffi_type): New bitfield member, by_value_in. (ffi_ptr_in_in, ffi_ptr_in_d_in): Elite in call if target type's by_value_in flag is clear. (ffi_struct_in): Short-circuit to a return if doing by-value, and the FFI struct type has no by-value semantics. (ffi_array_in_common): Likewise. In this code change, we just have to replace the test whether the element type has an in method with a test of its by_value_in flag. (make_ffi_type_pointer): Set by_value_in flag to 1, since pointers have by value in semantics. This is true also of ptr-in, because a structure passed as an in parameter to a function via ptr-in could itself contain ptr or ptr-out elements. (make_ffi_type_struct): Set the type's by_value_in if any element type's by_value_in is true. (make_ffi_type_array): Propagate the by_value_in flag from the element type to the array type. (ffi_call_wrap): Calculate the in_pass_needed local flag from the by_value_in flags of the arguments, not from whether or not they have an in function. Only call the in function for arguments which have the flag set.
Diffstat (limited to 'filter.h')
0 files changed, 0 insertions, 0 deletions