summaryrefslogtreecommitdiff
path: root/ext/fiddle/function.c
AgeCommit message (Collapse)Author
2018-10-10* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-10revisit `RARRAY_PTR()`.ko1
* ext/fiddle/function.c (initialize): use RARRAY_AREF() instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16add casts (cosmetic; just be explicit)shyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13function.c: fix typonobu
* ext/fiddle/function.c (initialize): fix typo "ary" to "args", and adjust type of variables to suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13* ext/fiddle/function.c: fix build error introduced at r53082.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13function.c: check argumentsnobu
* ext/fiddle/function.c (initialize): check all arguments first. reported by Marcin 'Icewall' Noga of Cisco Talos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-11NEWS: add note about Fiddle GVL releasenormal
* NEWS: note Fiddle GVL release [Feature #11607] * ext/fiddle/function.c (Init_fiddle_function): document above, too git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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-11-04ext: adjust index typenobu
* ext: use long for index instead of int and RARRAY_LENINT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-25use rb_check_arity [ci skip]nobu
* ext: use rb_check_arity and rb_error_arity to raise ArgumentError. [Feature #9025] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-31* ext/dl/*: remove DL as it is replaced by Fiddle.tenderlove
[Feature #5458] Thanks to Jonan Scheffler <jonanscheffler@gmail.com> for this patch * test/dl/*: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-09fiddle/function.c: fix memory leak on exceptionnobu
* ext/fiddle/function.c (function_call): fix memory leak when an exception occurs at argument conversion or the function call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-09fiddle/function.c: check argument sizenobu
* ext/fiddle/function.c (initialize): check argument number if the temporary buffer exceeds size_t max. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-15ext/fiddle: backward compatibilitiesnobu
* ext/fiddle/function.c, ext/fiddle/pointer.c: add macros for backward compatibilities. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-15function.c: adjust indentnobu
* ext/fiddle/function.c (parse_keyword_arg_i): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-14* ext/dl/lib/dl/func.rb (DL::Function#call): check tainted whennagachika
$SAFE > 0. * ext/fiddle/function.c (function_call): check tainted when $SAFE > 0. * test/fiddle/test_func.rb (module Fiddle): add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05use INT2FIX(0) instead of INT2NUM(0).kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11* ext/fiddle/function.c (Fiddle::Function.new): new keyword argument :name ↵ngoto
to set the name attribute. * ext/fiddle/lib/fiddle/import.rb (import_function, bind_function): set function name by using the :name keyword argument. Re-fixes r38243. [ruby-core:50566] * test/fiddle/test_function.rb (test_name): test for the :name keyword argument and Fiddle::Function#name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07* ext/fiddle/function.c (Fiddle::Function.new): fix typo in documentationngoto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* ext/fiddle/extconf.rb, ext/fiddle/function.cngoto
(Fiddle::Function::STDCALL): FFI_STDCALL is not a macro, but an enumeration. [ruby-core:50398] [Bug #7483] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38073 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-11-27* ext/fiddle/handle.c: Make Fiddle independent of DL, copy DL::Handletenderlove
to Fiddle::Handle. * ext/fiddle/pointer.c: Make Fiddle independent of DL, copy DL::Pointer to Fiddle::Pointer. * test/fiddle/test_func.rb: relevent tests * test/fiddle/test_handle.rb: ditto * test/fiddle/test_pointer.rb: ditto * ext/dl/lib/dl/struct.rb: use Fiddle::Pointer if available * ext/fiddle/extconf.rb: check for dlfcn.h * ext/fiddle/fiddle.c: add constants for sizeof() things * ext/fiddle/fiddle.h: include dlfcn.h * ext/fiddle/function.c: expose a C function for creating new Fiddle::Function objects. * ext/fiddle/lib/fiddle.rb: include constants for dl backwards compat * ext/fiddle/lib/fiddle/function.rb: read the pointer from the function for dl backwards compat. * test/dl/test_callback.rb: check the addresses of the pointers rather than their types. * test/fiddle/helper.rb: remove dependency on dl * test/fiddle/test_closure.rb: ditto * test/fiddle/test_fiddle.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-27reverting r37881tenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-27* ext/fiddle/handle.c: Make Fiddle independent of DL, copy DL::Handletenderlove
to Fiddle::Handle. * ext/fiddle/pointer.c: Make Fiddle independent of DL, copy DL::Pointer to Fiddle::Pointer. * test/fiddle/test_func.rb: relevent tests * test/fiddle/test_handle.rb: ditto * test/fiddle/test_pointer.rb: ditto * ext/dl/lib/dl/struct.rb: use Fiddle::Pointer if available * ext/fiddle/extconf.rb: check for dlfcn.h * ext/fiddle/fiddle.c: add constants for sizeof() things * ext/fiddle/fiddle.h: include dlfcn.h * ext/fiddle/function.c: expose a C function for creating new Fiddle::Function objects. * ext/fiddle/lib/fiddle.rb: include constants for dl backwards compat * ext/fiddle/lib/fiddle/function.rb: read the pointer from the function for dl backwards compat. * test/dl/test_callback.rb: check the addresses of the pointers rather than their types. * test/fiddle/helper.rb: remove dependency on dl * test/fiddle/test_closure.rb: ditto * test/fiddle/test_fiddle.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37881 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-01-05* Use _WIN32 rather than checking for windows.h. Thanks Jon Forums!tenderlove
[ruby-core:33977] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30450 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-05-06* ext/fiddle/function.c (function_call): removed unused variable.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27644 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