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

10917 Коммитов

Автор SHA1 Сообщение Дата
normal b6f9a60586 test_wait_for_single_fd.rb: remove with_pipe helper
IO.pipe natively accepts a block, nowadays.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-14 23:51:39 +00:00
normal 863e24b2b1 test_wait_for_single_fd: ensure this works with kqueue
Regardless of future features, this needs to work with
kqueue descriptors across platforms.

Today this will be useful for 3rd-party libraries using
kqueue.  In the future, Ruby may use kqueue natively
and we shall ensure we can wait on it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-14 23:51:35 +00:00
normal baaf3ba189 test_wait_for_single_fd.rb: relax test for newer FreeBSD
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-14 23:42:10 +00:00
nobu 6f0de6ed98 error.c: check redefined backtrace result
* error.c (rb_get_backtrace): check the result of `backtrace` even
  if the method is redefined.  [ruby-core:87013] [Bug #14756]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-14 08:33:14 +00:00
nobu 707c5ffab5 irb.rb: update `_`
* lib/irb.rb (IRB::Irb#eval_input): update `_` after exception.
  [ruby-core:86989] [Bug #14749]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-12 09:13:45 +00:00
nobu 4969fb6282 fix TestInputMethod
* test/irb/test_context.rb (TestInputMethod#initialize): fix typos
  and increment `line_no` only when not reaching the end.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-12 09:09:23 +00:00
kou 97c07d3487 rss: Add option Hash support to RSS::Parser.parse
Available options:

  * :validate
  * :ignore_unknown_element
  * :parser_class


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-12 09:06:00 +00:00
rhe 961cbe5262 openssl: merge changes in v2.1.1
Commits in upstream repository since v2.1.0 can be found at:

	https://github.com/ruby/openssl/compare/v2.1.0...v2.1.1

----------------------------------------------------------------
Kazuki Yamaguchi (7):
      test/utils: disable Thread's report_on_exception in start_server
      cipher: validate iterations argument for Cipher#pkcs5_keyivgen
      extconf.rb: fix build with LibreSSL 2.7.0
      test/test_pkey_rsa: fix test failure with OpenSSL 1.1.1
      test/test_ssl_session: set client protocol version explicitly
      Ruby/OpenSSL 2.0.8
      Ruby/OpenSSL 2.1.1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-12 07:33:53 +00:00
shugo 59630683d6 net/imap: Fix ArgumentError in send_string_data
Thanks to ShockwaveNN (Pavel Lobashov) for reporting the bug.
[ruby-core:86990] [Bug #14750]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-11 12:39:23 +00:00
kazu 0f4b4684cc Use `&.` instead of modifier if
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-11 12:12:57 +00:00
normal ec959fbb4b variable.c: fix multiple autoload with identical file (again)
We need to ensure autoload declarations pointing to the same
feature (aka "file") can wait on each other to avoid deadlock
situations.

So, reorganize autoload data structures to maintain a
feature => autoload_data_i mapping, and have module constant
tables point to the new autoload_const struct instead of
directly to autoload_data_i.  This allows multiple
autoload_const structs to refer to the SAME autoload_data_i
struct, and with it, the on-stack autoload_state.waitq.

The end result is different constants can share the same waitq
(tied to the feature name), and not deadlock each other during
loading.

Thanks to Eugene Kenny for the bug report and reproducible test case.

Reported-by: Eugene Kenny <elkenny@gmail.com>

* variable.c (autoload_featuremap): new global
  (struct autoload_const): new per-const struct
  (struct autoload_state): reference autoload_const instead of autoload_data_i
  (struct autoload_data_i): remove per-const
  (autoload_i_mark): delete from autoload_featuremap if unreferenced
  (autoload_c_mark): new dmark callback
  (autoload_c_free): new dfree callback
  (autoload_c_memsize): new memsize callback
  (autoload_const_type): new data type
  (get_autoload_data): set autoload_const as well
  (rb_autoload_str): use new data structures
  (autoload_delete): cleanup from autoload_featuremap
  (check_autoload_required): adjust for new internals
  (rb_autoloading_value): ditto
  (struct autoload_const_set_args): remove, redundant with autoload_const
  (const_tbl_update): adjust for new internals
  (autoload_const_set): ditto
  (autoload_require): ditto
  (autoload_reset): ditto
  (rb_autoload_load): ditto
  (rb_const_set): ditto
  (current_autoload_data): ditto
  (set_const_visibility): ditto
* test/ruby/test_autoload.rb (test_autoload_same_file): new test
  (test_no_leak): new test
  [ruby-core:86935] [Bug #14742]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-10 08:54:26 +00:00
normal 18b2cee206 revert r63387 and r63389 for now
I can't reproduce the problem on my 32-bit machine, and I have
connectivity problems to my 64-bit systems at the moment.
Will revisit in a few hours hopefully.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-10 05:10:13 +00:00
normal 6726038d76 variable.c: fix autoload object lifetimes and leak
We must not call normal Hash methods inside GC free callback,
either, however identity hash may be used.

[ruby-core:86935] [Bug #14742]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-10 04:18:28 +00:00
normal b74131132f variable.c: fix multiple autoload with identical file
We need to ensure autoload declarations pointing to the same
feature (aka "file") can wait on each other to avoid deadlock
situations.

So, reorganize autoload data structures to maintain a
feature => autoload_data_i mapping, and have module constant
tables point to the new autoload_const struct instead of
directly to autoload_data_i.  This allows multiple
autoload_const structs to refer to the SAME autoload_data_i
struct, and with it, the on-stack autoload_state.waitq.

The end result is different constants can share the same waitq
(tied to the feature name), and not deadlock each other during
loading.

Thanks to Eugene Kenny for the bug report and reproducible test case.

Reported-by: Eugene Kenny <elkenny@gmail.com>

* variable.c (autoload_featuremap): new global
  (struct autoload_const): new per-const struct
  (struct autoload_state): reference autoload_const instead of autoload_data_i
  (struct autoload_data_i): remove per-const
  (autoload_i_mark): delete from autoload_featuremap if unreferenced
  (autoload_c_mark): new dmark callback
  (autoload_c_free): new dfree callback
  (autoload_c_memsize): new memsize callback
  (autoload_const_type): new data type
  (get_autoload_data): set autoload_const as well
  (rb_autoload_str): use new data structures
  (autoload_delete): cleanup from autoload_featuremap
  (check_autoload_required): adjust for new internals
  (rb_autoloading_value): ditto
  (struct autoload_const_set_args): remove, redundant with autoload_const
  (const_tbl_update): adjust for new internals
  (autoload_const_set): ditto
  (autoload_require): ditto
  (autoload_reset): ditto
  (rb_autoload_load): ditto
  (rb_const_set): ditto
  (current_autoload_data): ditto
  (set_const_visibility): ditto
* test/ruby/test_autoload.rb (test_autoload_same_file): new test
  [ruby-core:86935] [Bug #14742]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-10 01:19:20 +00:00
k0kubun 179bc1b814 _mjit_compile_send.erb: revert r63350
Revert "_mjit_compile_send.erb: inline recursive call"

I reverted r63360 in r63379, but the errors were reproductive from
r63350. So I need to revert this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-09 17:11:07 +00:00
kazu 34002d12a6 Use `&.` instead of modifier if
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-09 12:51:14 +00:00
hsbt 5c1941a9be Merge csv-1.0.2 from upstream.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-09 04:39:16 +00:00
hsbt e75d8e0c65 Merge rdoc-6.0.4 from upstream.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-08 02:07:53 +00:00
kazu 3dd6c0d30c Remove unreachable break
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-08 00:00:13 +00:00
kazu e8ec23b1c0 Modify spaces [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-08 00:00:12 +00:00
k0kubun 6c62356e5a _mjit_compile_send.erb: inline recursive call
mjit_compile.c: propagate funcname to compile_insn

test_jit.rb: add test covering this behavior

* Benchmark

```
require 'benchmark_driver'

Benchmark.driver(runner: :time, repeat_count: 4) do |x|
  x.prelude %{
    def fib(x)
      return x if x == 0 || x == 1
      fib(x-1) + fib(x-2)
    end
  }
  x.report 'fib(40)'
  x.loop_count 1

  x.rbenv(
    'before,--jit',
    'before',
    'after,--jit',
    'after',
  )
  x.verbose
end
```

```
before,--jit: ruby 2.6.0dev (2018-05-08 trunk 63349) +JIT [x86_64-linux]
before: ruby 2.6.0dev (2018-05-08 trunk 63349) [x86_64-linux]
after,--jit: ruby 2.6.0dev (2018-05-08 trunk 63349) +JIT [x86_64-linux]
last_commit=_mjit_compile_send.erb: inline recursive call
after: ruby 2.6.0dev (2018-05-08 trunk 63349) [x86_64-linux]
last_commit=_mjit_compile_send.erb: inline recursive call
Calculating -------------------------------------
                     before,--jit      before  after,--jit       after
             fib(40)        2.886       8.685        2.562       8.800 s -       1.000 times

Comparison:
                          fib(40)
         after,--jit:         2.6 s
        before,--jit:         2.9 s - 1.13x  slower
              before:         8.7 s - 3.39x  slower
               after:         8.8 s - 3.44x  slower

```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-07 16:16:59 +00:00
kazu a4a66510fb Remove needless require [ci skip]
already require on top

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-07 15:08:46 +00:00
kazu 59c5d0b910 Use `&.` instead of modifier if and remove needless closed?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-07 15:07:51 +00:00
kazu 583572370a Fix a typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-07 14:44:55 +00:00
nobu 2ad7fb6dc1 optparse: Suppress warnings
Ruby warns "instance variable `@version` not initialized" for optparse when it receives `--version` option.

`test.rb`

```ruby
require 'optparse'
Version = '1'
OptionParser.new.parse(ARGV)
```

```
$ ruby -w test.rb --version
/home/pocke/.rbenv/versions/2.5.1/lib/ruby/2.5.0/optparse.rb:1168: warning: instance variable @version not initialized
/home/pocke/.rbenv/versions/2.5.1/lib/ruby/2.5.0/optparse.rb:1175: warning: instance variable @release not initialized
test 1
```

This change will suppress the warnings.

[Fix GH-1871]

From: Masataka Pocke Kuwabara <kuwabara@pocke.me>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-06 09:53:33 +00:00
nobu 955849c126 object.c: raise on long invalid float string
* object.c (rb_cstr_to_dbl_raise): check long invalid float
  string more precisely when truncating insignificant part.
  [ruby-core:86800] [Bug #14729]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-04 06:12:12 +00:00
k0kubun 6dd4657fc2 _mjit_compile_send.erb: retry inlining attr_reader
This reverts r63249 (revert r63212) and fixes a bug in it. The test to
prevent the bug is added as well.

vm_insnhelper.c: add `index` argument to vm_getivar. The argument is
created so that MJIT can pass the value of `cc->aux.index` on compilation
time.  The cache invalidation in _mjit_compile_send_guard.erb is only
working for the cache value on compilation time.
Note: As `index` is always passed as constant and it's force-inlined,
the performance of `vm_getivar` won't be degraded in VM.

_mjit_compile_send_guard.erb: New. Used to invalidate inlined values of cc.
common.mk: update dependencies for _mjit_compile_send_guard.erb

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-03 08:47:32 +00:00
normal 0e32c7c10a Revert "ext/cgi/escape: preserve String subclass in result"
This reverts commit 6afea14043 r63328
I misread the original bug report and got results flipped.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-03 01:24:09 +00:00
normal 6afea14043 ext/cgi/escape: preserve String subclass in result
* ext/cgi/escape/escape.c (optimized_escape_html): use rb_str_new_with_class
  (optimized_unescape_html): ditto
  (optimized_escape): ditto
  (optimized_unescape): ditto
* test/cgi/test_cgi_util.rb (test_escape_string_subclass): new test
  [ruby-core:86847] [Bug #14732]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02 23:18:55 +00:00
k0kubun d54e22860c test_jit.rb: test local variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02 16:27:33 +00:00
k0kubun db8e95587e test_jit.rb: test opt_aref_with again
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02 16:04:26 +00:00
k0kubun f15ce49364 test_jit.rb: make it possible to automatically find
untested insns. Resolved some warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02 15:41:43 +00:00
k0kubun d48efc4c83 test_jit.rb: verify tested insns
and fix some untested insns

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02 15:12:55 +00:00
nobu 853707123e object.c: fix exponent with underscore
* object.c (rb_cstr_to_dbl_raise): do not ignore exponent part
  when the input string longer than internal buffer contains
  underscore(s).  [ruby-core:86836] [Bug #14731]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02 13:37:18 +00:00
k0kubun 2af97e03b9 test_jit.rb: add missing dependency
The test works with make test-all, but I sometimes want to do a thing like:
`.ruby-svn/ruby -Itest/lib test/ruby/test_jit.rb -n test_clean_so`

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02 13:11:53 +00:00
k0kubun 14a3499c4f compile.c: mark catch_except_p of iseq
which has throw insn, not only ancestor iseqs of it.
I think we should remove catch_except_p flag and try to simplify the
catch table itself, to prevent similar bugs in the future.

test_jit.rb: add test to prevent the bug

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02 12:55:57 +00:00
normal f5db4a0cc2 test/thread/test_cv.rb: test CV usability inside forked child
* test/thread/test_cv.rb (def test_condvar_fork): new test
  [Bug #14725]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-30 23:53:55 +00:00
nobu 7727b22eb1 io.c: workaround for EPROTOTYPE
* io.c (internal_write_func, internal_writev_func): retry at
  unexpected EPROTOTYPE on macOS, to get rid of a kernel bug.
  [ruby-core:86690] [Bug #14713]

* ext/socket/init.c (rsock_{sendto,send,write}_blocking): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-30 02:17:03 +00:00
k0kubun d025f64a9f test_open3.rb: let test_popen2 work with --jit
test/lib/jit_support.rb: add .remove_mjit_logs to normalize stderr

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 09:22:07 +00:00
k0kubun 6090206275 test_rubyoptions.rb: let all tests work with --jit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 09:11:25 +00:00
k0kubun acacd7a1d3 test_bug_reporter.rb: make it work with --jit
test_rubyoptions.rb: replace gsub with sub because it's suboptimal for
this

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 09:02:56 +00:00
k0kubun 0b01776d43 test_rubyoptions.rb: let test_verbose work w/ --jit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 08:52:24 +00:00
k0kubun 9aab4b6bc7 test_parallel.rb: extend timeout for --jit-wait
testing. 10s was long enough for my machine, but not for travis.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 08:41:19 +00:00
k0kubun ada4198478 test_ftp.rb: extend read_timeout for --jit-wait
testing. I'm running `make test-all RUN_OPTS='--jit-wait'` and the
read_timeout was too slow for it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 08:24:44 +00:00
nobu d07861fb2f range.c: each on endless range
* range.c (range_each): endless range begins with string-like
  object should iterate from the converted result string, as well
  as `#each` on a string-end range or `#step` method on an endless
  range, i.e., `begin.succ` should not be called.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 07:31:32 +00:00
hsbt f114089585 Merge Pysch 3.0.3.pre1.
I added the following additional commits from 3.0.3.pre1:
    * https://github.com/ruby/psych/pull/356
    * https://github.com/ruby/psych/pull/357
    * https://github.com/ruby/psych/pull/359

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 01:47:58 +00:00
kou 1d67b9de28 rexml: disable XPath 1.0 compatible "#{ELEMENT_NAME}" processing by default
It breaks backward compatibility than I thought. So it's disabled by
default. It means that REXML's XPath processor isn't compatible with
XPath 1.0. But it will be acceptable for users.

We can enable it by specifying "strict: true" to
REXML::XPathParser.new explicitly.

* lib/rexml/xpath.rb,
  lib/rexml/xpath_parser.rb: Accept "strict: true" option.

* test/rexml/test_contrib.rb,
  test/rexml/xpath/test_base.rb: Use not XPath 1.0 compatible behavior.

* test/rexml/test_jaxen.rb: Use XPath 1.0 compatible behavior.

* test/rss/test_1.0.rb,
  test/rss/test_dublincore.rb,
  spec/ruby/library/rexml/element/namespace_spec.rb,
  spec/ruby/library/rexml/element/namespaces_spec.rb,
  spec/ruby/library/rexml/element/prefixes_spec.rb: Enable again.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 01:36:18 +00:00
nobu fa7fa92870 mjit.c: clean so file on Windows
* mjit.c (dlclose): use FreeLibrary to manage the reference count
  on the loaded module properly.

* mjit.c (clean_so_file): clean shared object file after unloaded,
  in-use files cannot be removed on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-27 07:39:00 +00:00
tenderlove c03f86b389 Revert "Fix use of `rb_profile_frames` start parameter"
This reverts commit r63265.

ko1 said I should not have committed this! I'm sorry!

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-27 00:13:51 +00:00
tenderlove d676ad1050 Fix use of `rb_profile_frames` start parameter
rb_profile_frames was always behaving as if the value given for the
start parameter was 0.

The reason for this was that it would check if (start > 0) { then
continue without updating the control frame pointer or anything other
than decrementing start.

[ruby-core:86147] [Bug #14607]

Co-authored-by: Dylan Thacker-Smith <Dylan.Smith@shopify.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-26 22:49:00 +00:00
nobu b7d260f185 test_numeric.rb: loose precision assertion
* test/ruby/test_numeric.rb (TestNumeric#test_step): remove a
  loose precision assertion, as Float cannot keep complete
  precision.  [ruby-core:86684] [Bug #14712]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-26 00:12:35 +00:00
nobu 067066fc9b compile.c: fix unconditional branch optimization
* compile.c (iseq_peephole_optimize): add dummy `putnil` after a
  `jump` replacing an unconditional branch, to adjust removed
  `dup`.  [ruby-core:86666] [Bug #14708]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-25 06:45:05 +00:00
nobu 2c8f16e6c0 string.c: fix scanned substring with `\K`
* string.c (scan_once): fix the matched substring with `\K`, the
  beginning of that string may differ from the matched position.
  [ruby-core:86663] [Bug #14707]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-24 12:25:46 +00:00
nobu 3471d0f6d6 rescue Errno::EPROTOTYPE
* test/webrick/test_httpserver.rb (test_gigantic_request_header):
  Errno::EPROTOTYPE is sometimes raised on Mac OS X 10.10.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-23 23:46:26 +00:00
normal 87ca4f3065 test/ruby/test_io.rb: add extra Thread#join to delay close
Maybe this fixes some CI failures.  Also, use different timeouts
for each item for hopefully easier diagnosis.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-23 05:54:06 +00:00
ko1 dd45691dbc Skip some tests to make CI healthy.
r63236 (or r63237) introduces test failures and CI shows errors.
This commit makes skipping these tests.  Please revert this commit
after tests (and rubyspec) work fine.

Failure log example:
https://gist.github.com/ko1/8456cf25fe35a696bd33ac86135092e4


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22 16:03:09 +00:00
kou 7a6f34103d rexml: Fix XPath bug of //#{ELEMENT_NAME}[#{POSITION}]
The position should be counted for each nodeset but the previous
implementation counts position for union-ed nodeset.

For example, "/a/*/*[1]" should be matched to "<c1/>" and "<c2/>" with
the following XML.

    <a>
      <b>
        <c1/>
      </b>
      <b>
        <c2/>
      </b>
    </a>

But the previous implementation just returns only "<c1/>".

* lib/rexml/element.rb (REXML::Attributes#each_attribute):
  Support Enumerator for no block use.

* lib/rexml/element.rb (REXML::Attributes#each):
  Support Enumerator for no block use.

* lib/rexml/functions.rb (REXML::Functions.string):
  Support NaN again.

* lib/rexml/xpath_parser.rb: Re-implement "Step" evaluator.
  It should evaluate "AxisSpecifier", "NodeTest" and "Predicate" in one
  step to respect position for each nodeset.

* test/rexml/test_jaxen.rb: Enable more tests. Remained tests should
  be also enabled but it'll not be near future.

* test/rexml/xpath/test_base.rb: Fix expected value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22 09:38:06 +00:00
kou 4d15e619eb rexml: Fix XPath bug of /#{ELEMENT_NAME}
It doesn't mean that all elements which name "ELEMENT_NAME" with any
namespace URI including null namespace URI. It means that all elements
which name "ELEMENT_NAME" with null namespace URI.

https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-NodeTest

> if the QName does not have a prefix, then the namespace URI is null
> (this is the same way attribute names are expanded).

We need to use "*[local-name()='#{ELEMENT_NAME}']" for all elements
which name "ELEMENT_NAME" with any namespace URI including null
namespace URI in XPath 1.0. But it's inconvenient. So this change
includes "*:#{LOCAL_NAME}" syntax support that is introduced since
XPath 2.0.

* lib/rexml/parsers/xpathparser.rb: Support "*:#{LOCAL_NAME}" syntax that
  is introduced since XPath 2.0.

* lib/rexml/xpath_parser.rb:
  * Fix namespace URI processing for "#{ELEMENT_NAME}". Now,
    "#{ELEMENT_NAME}" doesn't accept elements with null namespace URI.
  * Add "*:#{LOCAL_NAME}" support.

* test/rexml/test_contrib.rb,
  test/rexml/test_core.rb,
  test/rexml/xpath/test_base.rb: Follow this change.

* test/rexml/test_jaxen.rb: Fix namespace processing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22 08:09:04 +00:00
normal fed7f81b37 test/ruby/test_io.rb: try to diagnose stuck test_recycled_fd_close
I can't reproduce the problem myself, but gets loop seems ought
to give more useful information for tracking down where we're
stuck, at least.

Followup-to: r63217

cf. http://ci.rvm.jp/results/trunk-test@frontier/804284

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 23:32:18 +00:00
k0kubun c04881f94a test_jit.rb: follow the change of instruction
in r63225. Not strictly needed but to avoid confusion.

The JIT compiler itself seems working fine.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 13:15:43 +00:00
kou ee29985ded rexml: Enable more tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:45:42 +00:00
kou da89931dcc rexml: Fix XPath concat() implementation
* lib/rexml/functions.rb (REXML::Functions.concat): Implement.

* test/rexml/test_jaxen.rb: Enable one more test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:43:58 +00:00
kou 6793c0a227 rexml: Fix XPath string() implementation
* lib/rexml/functions.rb( REXML::Functions.string):
  * Support context node.
  * Fix implementation for document node to remove out of root nodes.
  * Support processing instruction node.
  * Improve implementation for integer to omit decimals.

* test/rexml/test_jaxen.rb: Enable processing instruction test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:39:43 +00:00
kou e044924ee5 rexml: Make more readable
test/rexml/test_jaxen.rb: Use more meaningful name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:21:41 +00:00
kou 1992cec52d rexml: Fix a test bug
test/rexml/test_jaxen.rb: Fix wrong assert_raise usage. Note that this code
isn't used yet.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:21:02 +00:00
kou daec80fe98 rexml: Make more readable
test/rexml/xpath/test_base.rb: Use here document for readability.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:18:08 +00:00
normal 7e9c19ad3d test/ruby/test_io.rb: add closing recycled FD test
Followup-to: r63216

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 04:02:41 +00:00
k0kubun e72a86fc93 _mjit_compile_send.erb: inline attr_reader call
_mjit_compile_send_guard.erb: carve out the shared logic to invalidate
inlined method call

common.mk: update dependency for this change

test_jit.rb: add test for attr_reader optimization

* Benchmark

```
require 'benchmark_driver'

Benchmark.driver do |x|
  x.prelude %{
    class C
      attr_reader :a
      def initialize
        @a = 1
      end
    end

    o = C.new

    def l o
      i = 0
      while i < 1000000
        o.a
        i += 1
      end
    end
  }
  x.report 'aread', %{ l o }
  x.loop_count 1000

  x.rbenv 'before', 'before,--jit', 'after,--jit'
  x.verbose
end
```

```
before: ruby 2.6.0dev (2018-04-20 trunk 63211) [x86_64-linux]
before,--jit: ruby 2.6.0dev (2018-04-20 trunk 63211) +JIT [x86_64-linux]
after,--jit: ruby 2.6.0dev (2018-04-20 trunk 63211) +JIT [x86_64-linux]
last_commit=_mjit_compile_send.erb: inline attr_reader call
Calculating -------------------------------------
                         before  before,--jit  after,--jit
               aread     54.597       122.894      218.574 i/s -      1.000k times in 18.316102s 8.137089s 4.575106s

Comparison:
                            aread
         after,--jit:       218.6 i/s
        before,--jit:       122.9 i/s - 1.78x  slower
              before:        54.6 i/s - 4.00x  slower

```

* Optcarrot

A little made faster?

fps: 71.35 -> 72.11

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-20 13:42:08 +00:00
normal b456eab2ea variable.c: fix thread + fork errors in autoload
This is fairly non-intrusive bugfix to prevent children
from trying to reach into thread stacks of the parent.
I will probably reuse this idea and redo r62934, too
(same bug).

* vm_core.h (typedef struct rb_vm_struct): add fork_gen counter
* thread.c (rb_thread_atfork_internal): increment fork_gen
* variable.c (struct autoload_data_i): store fork_gen
* variable.c (check_autoload_data): remove (replaced with get_...)
* variable.c (get_autoload_data): check fork_gen when retrieving
* variable.c (check_autoload_required): use get_autoload_data
* variable.c (rb_autoloading_value): ditto
* variable.c (rb_autoload_p): ditto
* variable.c (current_autoload_data): ditto
* variable.c (autoload_reset): reset fork_gen, adjust indent
* variable.c (rb_autoload_load): set fork_gen when setting state
* test/ruby/test_autoload.rb (test_autoload_fork): new test
  [ruby-core:86410] [Bug #14634]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-20 03:22:26 +00:00
nobu db885d0850 range.c: step in bignum
* range.c (range_step): honor step in bignum addition.
  [Feature #12912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-20 00:23:01 +00:00
nobu ad5a6aa790 range.c: fix fixnum loop condition
* range.c (range_step): FIXABLE + FIXABLE never overflow, but may
  not be FIXABLE.  [Feature #12912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-20 00:10:46 +00:00
nobu 5a5c9a706c fiddle/test_import.rb: fix warnings by rubygems
[Bug #14686]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 23:46:55 +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
kou 9090241e61 rexml: Fix a XPath bug that white spaces aren't ignored
lib/rexml/parsers/xpathparser.rb: Ignore white spaces in relative
location path.

test/rexml/xpath/test_base.rb: Add more test patterns and use more
debug friendly assertion style.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 21:34:40 +00:00
kou 632e10cad3 rexml: Fix wrong assertion
test/rexml/xpath/test_base.rb: Use constant value for the expected value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:51:07 +00:00
kou 8257fcb1db rexml: Use more debug friendly assertion style
test/rexml/xpath/test_base.rb: Expand loop assertion and stop to checking
just the first value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:49:53 +00:00
kou b5321ba446 rexml: Use more debug friendly assertion style
test/rexml/xpath/test_base.rb: Stop to use separated assertions for
checking array value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:48:28 +00:00
kou be000dcc15 rexml: Make more readable
test/rexml/xpath/test_base.rb: Use here document for XML.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:45:16 +00:00
mame d658a8d568 range.c: Make Range#bsearch support endless ranges
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:18:57 +00:00
mame db1bdecb0d Make Range#min, max, include?, cover?, and === to support endless range
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:18:53 +00:00
mame 7f95eed19e Introduce endless range [Feature#12912]
Typical usages:
```
p ary[1..]          # drop the first element; identical to ary[1..-1]
(1..).each {|n|...} # iterate forever from 1; identical to 1.step{...}
```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:18:50 +00:00
nobu c635662d7f dir.c: warning for NUL
* dir.c (rb_push_glob): warn NUL-separated glob patterns.
  [Feature #14643]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 07:05:39 +00:00
nobu 9760a7f905 Add slice method to ENV like Hash#slice
[Feature #14559]

From:    Benoit Tigeot <benoit@hopsandfork.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 05:55:42 +00:00
mame 8cd5ccdc7f test/ruby/test_super.rb: Remove unused assertions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:52:25 +00:00
mame a30d133a03 The test for TracePoint with thread had never worked correctly
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:47:58 +00:00
mame fcdabb50b8 The test for TracePoint#raised_exception had never worked correctly
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:47:56 +00:00
mame 2881a6d412 Remove the old disabled assertions for 1.8/1.9
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:47:56 +00:00
mame 84934e4f24 Enable the assertions that had been disabled for historical reason
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:26:20 +00:00
mame 035145722d Remove the assertions that have no meaning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:26:19 +00:00
mame dae960ed1d Remove the disabled old tests for Ruby 1.8/1.9 feature change
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:18:58 +00:00
mame 91596bb719 Use assert(false) for the path that is expected unreachable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:18:57 +00:00
mame c80339d05f test/date/test_date_base.rb: removed
It depends upon calendar.so which is not bundled.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:18:56 +00:00
mame c1d0768f34 test/csv/test_features.rb: enable accidentally-disabled assertions
CSV.new does not yield the instance.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 07:03:44 +00:00
mame 7735e2da11 test/zlib/test_zlib.rb (test_path): enable the accidentally-disabled assertion
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 06:38:08 +00:00
nobu f168dbd9ef parse.y: fix cmdarg in command_args
* parse.y (call_args): fix invalid CMDARG state after command_args
  followed by tLBRACE_ARG.  [ruby-core:86551] [Bug #14690]

From: Ilya Bylich <ibylich@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 01:22:26 +00:00
nobu 58a2084483 compile.c: align range
* compile.c (ibf_dump_object_struct): align range elements.
  [ruby-core:86548] [Bug #14689]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-16 12:46:08 +00:00
nobu cea438b0ca string.c: fix dumped suffix
* string.c (rb_str_dump): get rid of an error on evaling with
  frozen-string-literal enabled.  [ruby-core:86539] [Bug #14687]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-16 07:12:06 +00:00
nobu 5b2b1130cf string.c: fix checking order
* string.c (str_undump): check for suffix before if Unicode escape
  conflicts with it.  the message "but used force_encoding" sounds
  strange when it is not used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-16 06:37:42 +00:00
naruse 0cd595cb47 Extend timeout
On armv7 environment, the timeout is too short
http://rubyci.s3.amazonaws.com/scw-9d6766/ruby-trunk/log/20180319T191706Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-14 14:05:38 +00:00
nobu 9fa0d0058d irb.rb: restore the last error
* lib/irb.rb (eval_input): restore the last error `$!`, as the
  previous result.  [Feature #14684]

* lib/irb/context.rb (evaluate): add `exception` keyword argument
  to set the last error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-14 13:05:52 +00:00