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

46620 Коммитов

Автор SHA1 Сообщение Дата
nobu 4b39eaf4cc compile.c: binary logop check
* compile.c (compile_branch_condition): turn recursion at binary
  logical operator into loop by goto, and check the result of RHS
  of NODE_OR.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 10:27:27 +00:00
stomar 82092f4bb7 prime.rb: remove alias after timeout test
* test/test_prime.rb: remove alias after timeout test.

* lib/prime.rb: fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 10:21:44 +00:00
normal 508091d9cc speed up IO#close with many threads
Today, it increases IO#close performance with many threads:

  Execution time (sec)
  name            trunk   after
  vm_thread_close 4.276   3.018

  Speedup ratio: compare with the result of `trunk' (greater is better)
  name            after
  vm_thread_close 1.417

This speedup comes because rb_notify_fd_close only scans threads
inside rb_thread_io_blocking_region, not all threads in the VM.

In the future, this type data structure may allow us to notify
waiters of multiple FDs on a single thread (when using
Fibers).

* thread.c (struct waiting_fd): declare
  (rb_thread_io_blocking_region): use on-stack list waiter
  (rb_notify_fd_close): walk vm->waiting_fds instead
  (call_without_gvl): remove old field setting
  (th_init): ditto
* vm_core.h (typedef struct rb_vm_struct): add waiting_fds list
* (typedef struct rb_thread_struct): remove waiting_fd field
  (rb_vm_living_threads_init): initialize waiting_fds list

I am now kicking myself for not thinking about this 3 years ago
when I introduced ccan/list in [Feature #9632] to optimize this
same function :<

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 09:47:14 +00:00
watson1978 9cd66d7022 Improve Hash#merge performance
* hash.c (rb_hash_merge): use rb_hash_dup() instead of rb_obj_dup() to duplicate
    Hash object. rb_hash_dup() is faster duplicating function for Hash object
    which got rid of Hash#initialize_dup method calling.

    Hash#merge will be faster around 60%.
    [ruby-dev:50026] [Bug #13343] [Fix GH-1533]

### Before
                 user     system      total        real
Hash#merge   0.160000   0.020000   0.180000 (  0.182357)

### After
                 user     system      total        real
Hash#merge   0.110000   0.010000   0.120000 (  0.114404)

### Test code
require 'benchmark'

Benchmark.bmbm do |x|
  hash1 = {}
  100.times { |i| hash1[i.to_s] = i }
  hash2 = {}
  100.times { |i| hash2[(i*2).to_s] = i*2 }

  x.report "Hash#merge" do
    10000.times do
      hash1.merge(hash2)
    end
  end
end

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 09:23:46 +00:00
nobu 35c54a11b3 compile.c: fix catch-table labels optimization
* compile.c (remove_unreachable_chunk): do not eliminate chunks
  followed by labels in catch-table entries.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 02:11:24 +00:00
marcandre 68354c350a lib/prime: Fix primality of some large integers [#13492].
* lib/prime.rb: Use accurate sqrt to insure all factors are tested.
  Patch by Marcus Stollsteimer.

* test/test_prime.rb: Adapt test for timeout

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 00:36:55 +00:00
hsbt 825a1e939b Merge gemspec from ruby/fileutils.
* Replaced homepage option to source code location as github.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 23:39:58 +00:00
normal c018d46413 fix off-by-one in r58806
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 21:34:04 +00:00
normal b9f8fc510f test/ruby/test_io.rb: new test for IO.select exception set
Ensure this rarely-used feature of IO.select continues
to work properly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 21:33:15 +00:00
normal ea1ce47fd7 thread_sync.c: rewrite the rest using using ccan/list
The performance improvement increases as the number of waiters
increases, due to avoiding the O(n) behavior of rb_ary_delete on
the waiting thread.  Uncontended queues and condition variables
performance is not altered significantly.

Function entry cost is slightly increased for ConditionVariable,
since the data pointer is separately allocated and not embedded
into the RVALUE slot.

[ruby-core:81235] [Feature #13552]

name                  |trunk  |built
----------------------|------:|------:
vm_thread_condvar1    |  0.858|  0.858
vm_thread_condvar2    |  1.003|  0.804
vm_thread_queue       |  0.131|  0.129
vm_thread_sized_queue |  0.265|  0.251
vm_thread_sized_queue2|  0.892|  0.859
vm_thread_sized_queue3|  0.879|  0.845
vm_thread_sized_queue4|  0.599|  0.486

Speedup ratio: compare with the result of `trunk' (greater is better)

name                  |built
----------------------|------:
vm_thread_condvar1    |  0.999
vm_thread_condvar2    |  1.246
vm_thread_queue       |  1.020
vm_thread_sized_queue |  1.057
vm_thread_sized_queue2|  1.039
vm_thread_sized_queue3|  1.041
vm_thread_sized_queue4|  1.233

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 18:53:11 +00:00
normal 44e48eca5f thread_sync.c: rename mutex_waiter struct to sync_waiter
We will reuse this struct for ConditionVariable, Queue, and SizedQueue,
so it is no longer Mutex-specific.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 18:34:38 +00:00
naruse 79d9955180 Define classes for r58800
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 16:19:46 +00:00
svn 83af1c6a31 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 16:06:26 +00:00
naruse bd73d37471 Net::HTTP::STATUS_CODES is added as HTTP Status Code Repository [Misc #12935]
Note that 418 I'm a teapot doesn't exist because RFC 2324 and
RFC 7168 are not registered in IANA repository.
https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 16:06:25 +00:00
naruse cca77ee9ca Add more HTTP status classes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 16:06:18 +00:00
svn 61bbe32c21 * 2017-05-20
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 15:13:42 +00:00
naruse 67723c1e46 Net::HTTP#start now pass :ENV to p_addr by default [Bug #13351]
To avoid this, pass nil explicitly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 15:13:42 +00:00
nobu 0183613bf9 compile.c: dump_disasm_list_with_cursor
* compile.c (dump_disasm_list_with_cursor): improve disassemble
  list.  show whole elemetns and mark the current element.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 14:58:38 +00:00
naruse 7be47caa88 Merge latest dtoa.c [Bug #13545]
Apply some part of http://www.netlib.org/fp/dtoa.c with my eyes...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 14:14:52 +00:00
usa a4d51619e9 Of course, opened file is not able to unlink on Windows
* test/test_tempfile.rb (test_create_with_block): close the tempfile before
  unlink.  fixed a failure on Windows introduced at r58791.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 12:44:46 +00:00
nobu a6df192ded tempfile.rb: do not call File.identical? on closed stream
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:36:34 +00:00
svn 940f32eb5d * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:25:53 +00:00
shugo 84c1596342 net/imap: Net::IMAP#append should not block when NO response is received
[ruby-dev:50129] [Bug#13579]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:25:52 +00:00
nobu 3c5344bf30 tempfile.rb: remove in Tempfile.create
* lib/tempfile.rb (Tempfile.create): should not fail even if the
  temporary file has been removed in the block, just ignore.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:20:14 +00:00
duerst 94ddec6f9c add specs for Unicode-wide case conversions introduced in Ruby 2.4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 08:19:02 +00:00
duerst 0cbe2cfd65 improve examples, fix one improbably should_not value
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 08:05:56 +00:00
ko1 37da94857a specify unsigned (fix r58784).
* method.h (rb_method_definition_t#type): specify unsigned explicitly.
 Some compilers (includes VC) returns negative value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 07:54:04 +00:00
nobu 6c9027e03f fix syntax error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 07:34:05 +00:00
nobu 87023a1dcc eval_error.c: enrich backtrace
* eval_error.c (print_backtrace): add frame number when printing
  in reverse order.  [Feature #8661]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 07:12:45 +00:00
naruse 5b58d8e6d8 Add NEWS about [Feature #8661]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 06:14:43 +00:00
normal f82a930490 method.h: pack rb_method_definition_t struct
We only have 12 method types, so 4 bits is enough for
rb_method_type_t.

Size reductions:

- x86-64     48 => 40 bytes
- x86        28 => 24 bytes

* method.h (enum method_optimized_type): split out for CPP
  (struct rb_method_definition struct): pack on unaligned systems
  (rb_method_definition_t): split typedef to help ctags
  [ruby-core:81236] [Feature #13494]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 06:00:53 +00:00
k0kubun c26a9a7338 Fix strange indentation
which I introduced at r58773.
Hard tabs and spaces are mixed...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-18 15:13:30 +00:00
svn 0ea0f07f9c * 2017-05-19
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-18 15:06:48 +00:00
nobu 7cb0b3159f common.mk: path in parse.c
* common.mk (parse.c): replace source file name in #line pragmas
  with the path in the source directory, so that binary utilities,
  e.g. gcov, can find it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-18 15:06:47 +00:00
nobu 92690b6235 potential memory leak
* dir.c (rb_dir_getwd): get rid of potential memory leak.

* util.c (ruby_getcwd): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-18 11:29:42 +00:00
hsbt 97e824136f Fix a wrong repository name of simplecov.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-18 05:29:04 +00:00
svn 83b7e0bdaa * 2017-05-18
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-18 02:42:17 +00:00
hsbt 37abc2fb7e Improve CSV parsing performance.
Patch by @joshpencheon (Josh Pencheon)
  [fix GH-1607]

  #### benchmark-ips results
  ```
  trunk:
  Warming up --------------------------------------
                         4.000  i/100ms
  Calculating -------------------------------------
                         39.661  (±10.1%) i/s -      2.352k in 60.034781s
  with-patch:
  Warming up --------------------------------------
                         5.000  i/100ms
  Calculating -------------------------------------
                         60.521  (± 9.9%) i/s -      3.595k in 60.047157s
  ```

  #### memory_profiler resuts

  ```
  trunk:
  allocated memory by class
  -----------------------------------
    35588490  String
     7454320  Array
      294000  MatchData
       37340  Regexp
       11840  Hash
        2400  CSV
        1600  Proc
        1280  Method
         800  StringIO
  with-patch:
  allocated memory by class
  -----------------------------------
    18788490  String
     3454320  Array
      294000  MatchData
       37340  Regexp
       11840  Hash
        2400  CSV
        1600  Proc
        1280  Method
         800  StringIO
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-18 02:42:16 +00:00
ko1 8ffc4094a4 modify r58771.
* spec/rubyspec/command_line/dash_upper_s_spec.rb: enable tests on vboxsf
  (VirtualBox shared directory) and change tests to match /success$/ to
  ignore warnings. This technique is suggested by @unak.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 14:43:22 +00:00
k0kubun d06a7cfedd spec/rubyspec: Add `ruby_version_is` guard
for future backport to ruby/spec repository.

See r58772 r58773 r58774.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 14:11:01 +00:00
k0kubun 29a2600994 spec/rubyspec: Fix rubyspec for tilde unescape
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 13:21:09 +00:00
k0kubun e1b4327545 cgi/util.rb: Don't escape tilde in #escape
to make it compatible with ERB::Util.url_encode.

ext/cgi/escape/escape.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 12:34:59 +00:00
k0kubun 53127c2410 erb.rb: Don't encode tilde in #url_encode
Based on patch by madeofcode (Mark Dodwell).
[ruby-core:46168] [Bug #6696] [Fix GH-54]

`~` is a unreserved character.
https://tools.ietf.org/html/rfc3986#section-2.3

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 11:58:09 +00:00
ko1 95d3671e94 skip some tests on vboxsf.
* spec/rubyspec/command_line/dash_upper_s_spec.rb:


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 09:31:34 +00:00
hsbt 15cb9817a2 Optimize CSV#shift.
[Bug #12373][ruby-core:75462]
  Patch by Yuki Kurihara.

  Benchmark:
  ```
  Warming up --------------------------------------
           csv_shift     1.000  i/100ms
       new_csv_shift     1.000  i/100ms
Calculating -------------------------------------
           csv_shift      1.192  (± 0.0%) i/s -      6.000  in 5.034250s
       new_csv_shift      1.527  (± 0.0%) i/s -      8.000  in 5.243446s

Comparison:
       new_csv_shift:        1.5 i/s
           csv_shift:        1.2 i/s - 1.28x  slower
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 07:56:27 +00:00
naruse 0c0f75b798 Treat NULL reference case [Bug #13566]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 07:13:47 +00:00
naruse 9cf7985893 Merge Onigmo 6.1.2
1364ae3488

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 05:38:37 +00:00
nobu d9b9423ba8 ruby.c: encode script name
* ruby.c (process_options): encode script name to locale encoding
  instead of associate, if UTF-8 path.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 04:47:05 +00:00
nobu bd4a419d3e .gdbinit: fix nd_tree
* .gdbinit (nd_tree): use rb_str_tmp_new to get rid of
  `__extension__'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 04:44:12 +00:00
nobu a0b6e36609 test_dir_m17n.rb: read in filesystem encoding
* test/ruby/test_dir_m17n.rb (test_entries_compose): read in
  filesystem encoding instead of default external encoding on
  Windows too.  these two encodings may differ on some
  environments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 00:28:01 +00:00