| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This allows to relocate all FFI objects.
Also remove marking of StructLayout->cache_row in favour of clearing it at GC.compact only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ref: https://github.com/ffi/ffi/pull/991
Write barrier protected objects are allowed to be promoted to the old generation,
which means they only get marked on major GC.
The downside is that the RB_BJ_WRITE macro MUST be used to set references,
otherwise the referenced object may be garbaged collected.
This commit also implement a `dsize` function so that these instance report
a more relevant size in various memory profilers. It's not counting everything
because some types are opaque right now, so a larger refactoring would be needed.
|
|\
| |
| |
| | |
casperisfine-typed-data-struct
|
| |
| |
| |
| |
| |
| |
| | |
Ref: https://github.com/ffi/ffi/pull/991
The old untyped DATA API is soft deprecated and
this new one open the door to write barriers, compaction, memsize etc.
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| | |
Ref: https://github.com/ffi/ffi/pull/991
The old untyped DATA API is soft deprecated and
this new one open the door to write barriers, compaction, memsize etc.
|
|/
|
|
|
|
|
| |
Ref: https://github.com/ffi/ffi/pull/991
The old untyped DATA API is soft deprecated and
this new one open the door to write barriers, compaction, memsize etc.
|
|
|
|
|
|
| |
After fork() the dispatcher thread is no longer running, so it needs to be restarted in the child process.
Fixes #884
|
|
|
|
| |
The thread name is truncated in gdb to 15 characters, so that there was no distiction between "Callback Runner" and "Callback Dispatcher".
|
|\
| |
| |
| | |
DataDog-name-dispatcher-thread
|
| |
| |
| |
| | |
Similar to what was done for the dispatcher thread.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I found this useful while reviewing datadog/dd-trace-rb#1371 -- we were
searching for specs that leaked threads, and saw a "mysterious" thread
with no stack that we couldn't exactly point out what created it or
why it existed.
By setting a name on the callback thread, it becomes immediately
obvious when looking at `Thread.list` what this thread is and where
it comes from.
(Thread naming has been around
[since Ruby 2.3](https://github.com/ruby/ruby/blob/v2_3_0/NEWS) which
means we can do it safely for every supported version)
|
|/ |
|
|\
| |
| |
| | |
https://github.com/Watson1978/ffi into Watson1978-fix-crash-on-apple-silicon
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Only very old Visual-C compilers before 2010 didn't contain these files.
Since the copyright of the included files conflicts with ffi's license,
we better remove it.
Fixes #693
|
|/
|
|
| |
Fixes #820
|
|
|
|
| |
Now that the gemspec requires ruby-2.3 or newer, compatibility code can be removed.
|
|
|
|
| |
Such callbacks returned nan before.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Ruby 2.7 deprecates taint and it no longer has an effect.
https://bugs.ruby-lang.org/issues/16131
The APIs related to taint cause deprecation warning message and the lack
of taint support should not cause a problem in previous Ruby versions.
So I removed that. But if need to taint support that to old versions
of Ruby, I will update PR.
|
| |
|
|
|
|
|
|
|
| |
All supported ruby versions have rb_thread_call_without_gvl() and rb_thread_call_without_gvl(),
so that we can finally get rid of the old code.
This improves readability of Function.c a lot.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
callbacks
This fixes #527 and other interoperability issues that can happen,
when a callback is called without a valid call frame.
The change is enabled for ruby-2.3+ only, since it requires the
functions ruby_native_thread_p() and ruby_thread_has_gvl_p().
The creation of a call frame is not (yet) removed, because
it still carries callback expections around.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 9f257af19e6088c2986f85dea17455e52a2be405.
This is due to issues with callback in combination with fork() on Centos.
See https://github.com/ffi/ffi/issues/621 .
It is caused by specialized handling of callback allocation on SE-Linux
protected systems through ffi_closure_alloc(), which is incompatible to fork().
Reverting this now, pending more investigation, how we can solve callback
allocation in a way that is compatible to both PaX and SE-Linux.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes declarations for ruby-2.0 and newer.
rubies < 2.0 don't define ruby/thread.h, so that the warnings are still present there.
compiling ../../../../ext/ffi_c/Call.c
In file included from ../../../../ext/ffi_c/Call.h:36:0,
from ../../../../ext/ffi_c/Function.h:48,
from ../../../../ext/ffi_c/Call.c:57:
../../../../ext/ffi_c/Call.c: In function ‘rbffi_do_blocking_call’:
../../../../ext/ffi_c/Thread.h:78:39: warning: implicit declaration of function ‘rb_thread_call_without_gvl’; did you mean ‘rb_thread_wait_for’? [-Wimplicit-function-declaration]
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
^
../../../../ext/ffi_c/Call.c:334:5: note: in expansion of macro ‘rbffi_thread_blocking_region’
rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compiling ../../../../ext/ffi_c/Function.c
../../../../ext/ffi_c/Function.c: In function ‘async_cb_event’:
../../../../ext/ffi_c/Function.c:569:9: warning: implicit declaration of function ‘rb_thread_call_without_gvl’; did you mean ‘rb_thread_call_with_gvl’? [-Wimplicit-function-declaration]
rb_thread_call_without_gvl(async_cb_wait, &w, async_cb_stop, &w);
^~~~~~~~~~~~~~~~~~~~~~~~~~
rb_thread_call_with_gvl
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes ClosurePool. It has been switching pages protection between
writable and executable, which was making it incompatible with PaX
MPROTECT.
libffi instead leaves its closures (closure trampolines) non-executable,
relying on PaX to recognize and emulate them, which allows it to work
even under such circumstances.
Remove CUSTOM_TRAMPOLINE and USE_RAW to avoid ifdef hassle.
|
|
|
|
|
|
|
|
|
|
|
| |
RB_GC_GUARD_PTR is an 'internal' API and consumers should only use
RB_GC_GUARD. On non-GCC/non-MSC compilers (i.e. "Sun" Compiler on
Solaris or xlc compiler on AIX) this macro does not exist in a usable
form.
In this case both of the instances of RB_GC_GUARD_PTR were unnecessary
since argv was already protected and rbParams was ALLOCA_N'd onto the
stack which does not require protection.
|
|
|
|
|
|
|
|
|
| |
The return type is not used but caused a compiler warning:
Function.c: In function 'callback_invoke':
Function.c:479:9: warning: passing argument 1 of 'rb_thread_call_with_gvl' from incompatible pointer type [enabled by default]
Function.c:102:14: note: expected 'void * (*)(void *)' but argument is of type 'VALUE (*)(void *)'
This addresses issue #297.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
callback parameters.
This is triggered in callback_spec in "struct by reference argument".
Valgrind stacktrace:
==22636== Invalid read of size 8
==22636== at 0xBF964B3: invoke_callback (Function.c:763)
==22636== by 0x4EA66BD: rb_rescue2 (eval.c:714)
==22636== by 0xBF9638A: callback_with_gvl (Function.c:737)
==22636== by 0xBF96054: callback_invoke (Function.c:475)
==22636== by 0xC1B18CA: ffi_closure_unix64_inner (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1)
==22636== by 0xC1B1C43: ffi_closure_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1)
==22636== by 0xC1B1ADB: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1)
==22636== by 0xC1B140B: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1)
==22636== by 0xBF9FB43: rbffi_CallFunction (Call.c:378)
==22636== by 0xBF9FFD5: custom_trampoline (MethodHandle.c:232)
==22636== by 0x4FCE5DE: vm_call_cfunc_with_frame (vm_insnhelper.c:1469)
==22636== by 0x4FDC4FC: vm_call_method (vm_insnhelper.c:1559)
==22636== Address 0xbb9fc30 is 8 bytes after a block of size 24 alloc'd
==22636== at 0x4C2A2DB: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22636== by 0x4EC06E7: vm_xmalloc (gc.c:3519)
==22636== by 0xBF9B2EB: builtin_type_new (Type.c:151)
==22636== by 0xBF9C95E: rbffi_Type_Init (Type.c:389)
==22636== by 0xBF94A7B: Init_ffi_c (ffi.c:75)
==22636== by 0x4E6048C: dln_load (dln.c:1354)
==22636== by 0x4FDEE59: rb_vm_call_cfunc (vm.c:1530)
==22636== by 0x4EAA960: rb_require_safe (load.c:963)
==22636== by 0x4FCE5DE: vm_call_cfunc_with_frame (vm_insnhelper.c:1469)
==22636== by 0x4FD3089: vm_exec_core (insns.def:1017)
==22636== by 0x4FD74A9: vm_exec (vm.c:1201)
==22636== by 0x4FDE7ED: rb_iseq_eval (vm.c:1436)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
More documentation
|
| |
| |
| |
| | |
and ConstGenerator.
|
|/
|
|
|
|
| |
This mostly done by replacing posix with win32 functions,
but it's working with rb_thread_select() and blocking _pipes,
since rb_io_wait_readable() doesn't work with nonblocking pipes.
|
| |
|
| |
|
| |
|
| |
|