diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-05-02 20:24:46 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-05-02 20:24:46 -0700 |
commit | 138852dc2210b46ef3e4607d21cd4ebdbb596751 (patch) | |
tree | 0bb3b5b4f1010d5719115d35024ffe8f75d2eb6f /genvim.txr | |
parent | 836d73010330cfe12eff4d99edbef46755d7fd97 (diff) | |
download | txr-138852dc2210b46ef3e4607d21cd4ebdbb596751.tar.gz txr-138852dc2210b46ef3e4607d21cd4ebdbb596751.tar.bz2 txr-138852dc2210b46ef3e4607d21cd4ebdbb596751.zip |
ffi: remove the rtvec mechanism.
Removing the rtvec[] mechanism for tracking temporary
allocations. The tft->in() calls are already walking the
object layout and so pointers can just be retrieved from the
object memory. This changes the semantics: for the better, I
think.
For example if a struct contains a (ptr str) and is passed as
(ptr (struct ...)), the C string is temporarily allocated and
stored in the C structure before the call, then freed after
the call. Now the freeing action retrieves the char * pointer
from the structure itself rather than rtvec. The semantics
change is that the pointer may have been altered by the C
function. We may be freeing a pointer other than the one we
allocated. C code which replaces the pointer must malloc it,
and free the original.
* ffi.c (struct txr_ffi_type): put and in virtual function
pointers lose the rtvec parameter.
(ffi_void_put ffi_i8_put, ffi_u8_put, ffi_i16_put,
ffi_u16_put, ffi_i32_put, ffi_u32_put, ffi_i64_put,
ffi_u64_put, ffi_char_put, ffi_uchar_put, ffi_short_put,
ffi_ushort_put, ffi_int_put, ffi_uint_put, ffi_long_put,
ffi_ulong_put, ffi_float_put, ffi_double_put, ffi_wchar_put,
ffi_cptr_put, ffi_str_d_put, ffi_wstr_put, ffi_wstr_d_put,
ffi_buf_put, ffi_buf_d_put, ffi_closure_put): Drop unused
rtvec parameter.
(freeing_in, ffi_ptr_in_in, ffi_ptr_out_in): Drop rtvec
parameter. Obtain pointer from src buffer instead.
(ffi_str_put, ffi_ptr_in_put, ffi_ptr_out_put, ffi_ptr_put):
Drop rtvec parameter and remove code which stored into rtvec.
(ffi_ptr_in_d_put, ffi_struct_put, ffi_array_put): Drop rtvec
parameter; don't pass to recursive put call.
(ffi_struct_in, ffi_array_in): Drop rtvec parameter; don't
pass to recursive in call.
(make_ffi_type_builtin, make_ffi_type_pointer): Adjust pointer
parameter declarators for put and in parameters.
(ffi_call_wrap): Remove allocation and use of rtvec.
Pass the values[i] pointer as the src parameter in the
to level in call.
(ffi_closure_dispatch): Don't pass rtvec parameter to
put call.
Diffstat (limited to 'genvim.txr')
0 files changed, 0 insertions, 0 deletions