summaryrefslogtreecommitdiff
path: root/ext/fiddle/closure.c
AgeCommit message (Collapse)Author
2015-12-09* ext/**/*.c (*_memsize): same as r52986 for extensions.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23fiddle: release GVL for ffi_callnormal
Some external functions I wish to call may take a long time and unnecessarily block other threads. This may lead to performance regressions for fast functions as releasing/acquiring the GVL is not cheap, but can improve performance for long-running functions in multi-threaded applications. This also means we must reacquire the GVL when calling Ruby-defined callbacks for Fiddle::Closure, meaning we must detect whether the current thread has the GVL by exporting ruby_thread_has_gvl_p in internal.h * ext/fiddle/function.c (struct nogvl_ffi_call_args): new struct for GVL release (nogvl_ffi_call): new function (function_call): adjust for GVL release [ruby-core:71642] [Feature #11607] * ext/fiddle/closure.c (struct callback_args): new struct for GVL acquire (with_gvl_callback): adjusted original callback function (callback): wrapper for conditional GVL acquire * ext/fiddle/depend: add dependencies * ext/fiddle/extconf.rb: include top_srcdir for internal.h * internal.h (ruby_thread_has_gvl_p): expose for fiddle * vm_core.h (ruby_thread_has_gvl_p): moved to internal.h * test/fiddle/test_function.rb (test_nogvl_poll): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-05ext: use RARRAY_AREFnobu
* ext/**/*.c: prefer RARRAY_AREF to indexing RARRAY_CONST_PTR. pointed out by hanmac. https://github.com/ruby/ruby/commit/3553a86#commitcomment-14187670 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-04ext: use RARRAY_CONST_PTRnobu
* ext/bigdecimal/bigdecimal.c: use RARRAY_CONST_PTR just fore reference instead of RARRAY_PTR, to keep the array WB-protected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-19ext/fiddle/closure.c (callback): static functionnormal
The `callback' function is not used outside of closure.c and should not be able to cause namespace conflicts in compilers without visibility pragmas. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-30protoize no-arguments functionsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-29* ext/fiddle/closure.c: use sizeof(*pcl) for correct sizeof value.mame
[ruby-core:57599] [Bug #8978]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-28* ext/fiddle/closure.c: use sizeof(*pcl) for correct sizeof value.tenderlove
[ruby-core:57599] [Bug #8978]. Thanks mame! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-11* ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): define 0 onnaruse
Mac OS X and Linux [Bug #3371] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-11* ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): add missing case:naruse
RUBY_LIBFFI_MODVERSION is not defined (usually on Windows). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-10* ext/fiddle/extconf.rb: define RUBY_LIBFFI_MODVERSION macro.naruse
* ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): define 0 or 1 with platform and libffi's version. [Bug #3371] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-10* ext/fiddle/closure.c (initialize): check mprotect's return value.naruse
If mprotect is failed because of PaX or something, its function call will cause SEGV. http://c5664.rubyci.org/~chkbuild/ruby-trunk/log/20130401T210301Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07* ext/fiddle/closure.c (Fiddle::Closure.new): fix typo in documentationngoto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* ext/fiddle/closure.c: cosmetic fix for rdoc comment. (fix for r37917)nagachika
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* ext/fiddle/closure.c: Documentation for Fiddlezzak
* ext/fiddle/lib/fiddle/import.rb: ditto * ext/fiddle/lib/fiddle/value.rb: ditto * ext/fiddle/lib/fiddle/pack.rb: ditto * ext/fiddle/lib/fiddle/cparser.rb: ditto * ext/fiddle/lib/fiddle/struct.rb: ditto * ext/fiddle/lib/fiddle/function.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-27* ext/fiddle/closure.c: Documentation for Fiddlezzak
* ext/fiddle/pointer.c: ditto * ext/fiddle/function.c: ditto * ext/fiddle/lib/fiddle.rb: ditto * ext/fiddle/fiddle.c: ditto * ext/fiddle/handle.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15* ext/fiddle/closure.c (callback): deal with unsinged integers.nobu
[ruby-core:42458][Bug #5991][Bug #6022] * ext/fiddle/conversions.c (value_to_generic, generic_to_value): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15* ext/fiddle/closure.c (callback): same as r34506.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-15* io.c, thread.c, ext/pty/pty.c, ext/fiddle/closure.c: useakr
__linux__ macro for consistency. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-15* ext/.document (fiddle): Remove duplicate entrydrbrain
* ext/fiddle: Complete documentation of Fiddle. Patch by Vincent Batts. [#5192] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-09* ext/fiddle/conversions.c (generic_to_value): ffi_arg and ffi_sargngoto
should be used to handle shorter return value. fix [Bug #3861] [ruby-core:32504] * ext/fiddle/closure.c (callback): ditto * ext/fiddle/conversions.h (fiddle_generic): ditto * ext/fiddle/conversions.c (value_to_generic): char, short and int are strictly distinguished on big-endian CPU, e.g. sparc64. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-28* ext/fiddle/closure.c (callback): use rb_ary_tmp_new() instead ofnagachika
xmalloc() to allocate an array for arguments of callback procedure, to prevent arguments from being swept by GC. [ruby-core:38546] [Bug #4929] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-30* ext/fiddle/closure.c (fiddle_closure): embed cif not referencenobu
so that the content surely get initialized. [ruby-dev:42480] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-14* ext/fiddle/closure.c : Don't use FFI closure alloc on OpenBSD.tenderlove
Thanks Jeremy Evans! [ruby-core:32384] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-20* ext/fiddle/closure.c (closure_data_type),nobu
ext/fiddle/function.c (function_data_type): rb_data_type_t has changed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-13* ext/fiddle/closure.c (dealloc): refix workaround r28300.naruse
don't use ffi_closure_alloc, ffi_prep_closure_loc and ffi_closure_free on MACOSX and __linux__. [ruby-dev:41483] [ruby-dev:41214] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-12* ext/fiddle/closure.c (dealloc): workaround fix for libffi'snaruse
ffi_closure_free. [ruby-dev:41483] [ruby-dev:41214] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-06* ext/fiddle/*: Adding fiddle library to wrap libffitenderlove
* test/fiddle/*: testing fiddle extension * ext/dl/lib/dl.rb: Requiring fiddle if it is available * ext/dl/lib/dl/callback.rb: using Fiddle if it is available * ext/dl/lib/dl/func.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e