Граф коммитов

163 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 715955ff27
Include ruby/assert.h in ruby/ruby.h so that assertions can be there 2019-07-14 17:58:03 +09:00
nobu 3d1c86a26f Removed moving toplevel header since r12501
Moving public headers was 12-years ago, no depend files would
expect ruby.h in the top source directory now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-08 02:46:22 +00:00
tadd b640b21d9c fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 07:40:45 +00:00
hsbt d303a2c45a Merge fiddle from github repository.
* ext/fiddle/extconf.rb: It supports to build libffi with standalone gem.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 07:27:18 +00:00
svn 50281e8ca3 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-10 04:24:11 +00:00
ko1 228fc417ce revisit `RARRAY_PTR()`.
* 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-10-10 04:24:10 +00:00
nobu eb02a846a4 fiddle/import.rb: suppress warning
* ext/fiddle/lib/fiddle/import.rb: suppress exception report when
  $DEBUG is enabled.  [ruby-core:86536] [Bug #14686]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 23:35:39 +00:00
normal 604a96d9de ext/fiddle/lib/fiddle/pack.rb: pack "void *" properly on 32-bit
Fixes: r62450 (commit 1aaeeb326e)
       ("long long is a C99ism")

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-18 00:38:35 +00:00
shyouhei 1aaeeb326e long long is a C99ism
so SIZEOF_LONG_LONG is not always available.
We have to check its defined?-ness before using.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-17 09:51:23 +00:00
shyouhei 28d0fee9f6 add casts (cosmetic; just be explicit)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 08:49:09 +00:00
nobu c8094ff154 no ID cache in Init functions
Init functions are called only once, cache is useless.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 08:39:48 +00:00
hsbt 9ef078e2a7 Bump fiddle-1.0.0 for released version.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 08:35:13 +00:00
hsbt 7d2e5fb979 Added explicitly require to example code.
https://github.com/ruby/ruby/pull/1666

  Patch by @guilherme [fix GH-1666]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:55:22 +00:00
hsbt eccbd8c0ef Fixup r59961. Use http for libffi downloading.
A few environments couldn't handle https download.
    * https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-trunk/log/20170919T032511Z.fail.html.gz
    * https://rubyci.org/logs/www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20170919T040500Z.fail.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-19 05:01:02 +00:00
hsbt e9f5265bd7 Use https instead of ftp for libffi downloading.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-19 02:25:16 +00:00
hsbt 7f24b0aabd Merge fiddle-1.0.0.beta2 from upstream.
* ext/fiddle/closure.c: use directly declaration for standalone gem
    without internal.h.
  * Specify frozen string literal is true.
  * Update gemspec configuration for release version.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-12 11:52:23 +00:00
hsbt 0a907a3792 Make string literal to frozen object on gemspec of defulte gems.
Added following gemspecs.

    * extensions: date, dbm, etc, fiddle, gdbm, sdbm, stringio, strscan, zlib
    * pure ruby libraries: cmath, csv, fileutils, scanf, webrick

  psych and rdoc is out of scope of this commit. I will merge after
  upstream was change to `frozen_string_literal: true`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-19 13:03:06 +00:00
nobu 966bfb07f6 Add sha512
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-22 00:27:14 +00:00
hsbt 4389ba641f Added initial gemspec for ruby/fiddle.
[Feature #13403][ruby-core:80577]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-05 11:04:25 +00:00
shyouhei 20c72dc89d ruby tool/update-deps --fix
Onigumo 6 (r57045) introduced new onigumo.h header file, which is
required from quite much everywhere.  This commit adds necessary
dependencies.

Note: ruby/oniguruma.h now includes onigumo.h,
      ruby/io.h includes oniguruma.h,
      ruby/encoding.h also includes oniguruma.h,
      and internal.h includes encoding.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-22 06:00:18 +00:00
nobu 0da70829f1 fiddle/depend: build-libffi
* ext/fiddle/depend (build-libffi): get rid of making $(LIBFFI_A)
  a sole target, which may be empty when installed libffi is
  found.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-11 10:33:05 +00:00
nobu 35533d0346 fiddle: fix $(SUBMAKE_PRE)
* ext/fiddle/extconf.rb: fix $(SUBMAKE_PRE) to chdir to
  $(LIBFFI_DIR) instead of $(@D), since $(LIBFFI_A) is not
  underneath libffi but under .libs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-10 04:24:08 +00:00
nobu 3c06d3a6bd fiddle: jobserver for libffi
* ext/fiddle/depend (libffi): use $(MAKE) explicitly for recursive
  make, so that jobserver works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-09 12:08:56 +00:00
nobu 64fea27496 Update dependencies
* common.mk (compile.o, loadpath.o): update dependencies.

* common.mk (vm_call.o): remove stale object dependencies.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 05:48:13 +00:00
nobu bf6a8134f8 fiddle/import.rb: suppress warnings
* ext/fiddle/lib/fiddle/import.rb (type_alias, handler): suppress
  "not initialized instance variable" warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 04:28:16 +00:00
nagachika 79c7a51893 * ext/fiddle/handle.c: check tainted string arguments.
Patch provided by tenderlove and nobu.

* test/fiddle/test_handle.rb (class TestHandle): add test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 12:08:49 +00:00
naruse c4fdfabcc8 handle ext/ as r53141
g -L frozen_string_literal ext/**/*.rb|xargs ruby -Ka -e'ARGV.each{|fn|puts
fn;open(fn,"r+"){|f|s=f.read.sub(/\A(#!.*\n)?(#.*coding.*\n)?/,"\\&#
frozen_string_literal: false\n");f.rewind;f.write s}}'

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:31:54 +00:00
nobu 4977af3c3d function.c: fix typo
* 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 10:57:51 +00:00
usa de577357e8 * ext/fiddle/function.c: fix build error introduced at r53082.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 10:25:01 +00:00
nobu bcc2421b49 function.c: check arguments
* 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-13 09:35:58 +00:00
nobu 34a0df159b conversions.h: PTR2NUM
* ext/fiddle/conversions.h (PTR2NUM): use signed integer to make
  Fixnum for negative values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 09:35:10 +00:00
normal a26d09da85 NEWS: add note about Fiddle GVL release
* 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-11 07:43:09 +00:00
ko1 dff42b0ea0 * ext/**/*.c (*_memsize): same as r52986 for extensions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 01:01:17 +00:00
normal 15476c695d fiddle: release GVL for ffi_call
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-23 21:20:56 +00:00
nobu 57e2877e7b ext: use RARRAY_AREF
* 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-05 01:09:17 +00:00
nobu 3553a86eb5 ext: use RARRAY_CONST_PTR
* 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-04 07:27:10 +00:00
nobu 52912db4a8 ext: adjust index type
* 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-11-04 07:18:01 +00:00
nobu 898fd2ed2a use rb_check_arity [ci skip]
* 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
2015-10-25 00:43:06 +00:00
normal cfa2f95476 ext/fiddle/closure.c (callback): static function
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
2015-10-19 20:56:08 +00:00
nobu 07900180ec fiddle: $LOCAL_LIBS needs to be expanded
* ext/fiddle/extconf.rb: revert part of r51401 and expand
  $LOCAL_LIBS as it will be extracted and copied to exts.mk.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-29 07:53:12 +00:00
nobu 7d8ac59131 fiddle: clean dot dir
* ext/fiddle/depend (distclean-libffi): clean dot directory too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-27 03:46:07 +00:00
nobu 50a585ed25 fiddle: unexpand LIBFFI_DIR
* ext/fiddle/extconf.rb: use LIBFFI_DIR instead of expanding it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-27 03:45:11 +00:00
hsbt 5d6ca9e950 * include/ruby/ruby.h: $SAFE=2 is now obsolete.
* dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c
  gc.c, io.c, process.c, safe.c, signal.c, win32/file.c:
  removed code for $SAFE=2
* test/erb/test_erb.rb, test/fiddle/test_handle.rb
  test/ruby/test_env.rb: removed tests for $SAFE=2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18 14:21:03 +00:00
akr 606274b55d * ext/fiddle/depend: Fix "Wrong mix of special targets" error with
OpenBSD make.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12 00:10:52 +00:00
nobu dc8d595461 libff: fix enable-shared condition
* ext/fiddle/extconf.rb: needs --enable-shared when linked to
  libruby or fiddle.so.  since --with-static-linked-ext does no
  longer link extensions to ruby program with --enable-shared, the
  only combination needs --enable-static is --disable-shared and
  --with-static-linked-ext.  [ruby-dev:48901] [Bug #10960]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-13 02:37:49 +00:00
nobu 22c750bb8d libffi: workaround of VC12 ml
* ext/fiddle/win32/libffi.mk.tmpl: assemble without directory prefix.
  workaround of a bug of VC12 ml, by unak at [ruby-core:67792].
  [ruby-core:67789] [Bug #10780]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-24 15:42:27 +00:00
nobu 8cfce15387 fiddle: --disable-bundled-libffi
* ext/fiddle/extconf.rb: disable bundled libffi if explicitly
  disabled by --disable-bundled-libffi.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-17 10:52:17 +00:00
nobu 24b6863f79 fiddle: check assembler
* ext/fiddle/extconf.rb: requires assembler for src/win{32,64}.S.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-11 03:54:45 +00:00
nobu 463856a7c4 fiddle: fix for old VC
* ext/fiddle/win32/libffi-3.2.1-mswin.patch (include/ffi.h.in):
  old version VCs did not support long long, use __int64 instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-11 03:54:35 +00:00
nobu 544651a2fb cparser.rb: limit word number
* ext/fiddle/lib/fiddle/cparser.rb (parse_ctype): limit split word
  number as the rest are not used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-03 09:53:30 +00:00