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

50380 Коммитов

Автор SHA1 Сообщение Дата
svn 631272ff15 * 2018-03-23
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 16:05:05 +00:00
nobu e852f9d624 test_exception.rb: assertions with Exception.to_tty?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 16:05:04 +00:00
kazu 9d091c851a sample/timeout.rb: Remove unnecessary increment [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 13:01:17 +00:00
naruse 234a30459c set UTF-8 if given URI string is ASCII
Now URI is normally UTF-8, and US-ASCII URI string is considered as
escaped a UTF-8 string.
https://github.com/rails/rails/issues/32294

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 11:20:03 +00:00
nobu b9881083f1 error.c: full_message options
* error.c (exc_full_message): add highlight: and reverse: keyword
  options.  [Bug #14324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 08:26:23 +00:00
naruse 42f1b58964 Factor out get_reg_grapheme_cluster
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 07:58:39 +00:00
naruse 41b2ef4685 fix each_grapheme_cluster's size [Bug #14363]
From: Hugo Peixoto <hugo.peixoto@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 07:58:38 +00:00
naruse 6e0f5b8407 Revert "each_grapheme_cluster shouldn't return size [Bug #14363]"
This reverts commit r62887.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 07:58:37 +00:00
naruse 613decd088 each_grapheme_cluster shouldn't return size [Bug #14363]
From: Stefan Schüßler <mail@stefanschuessler.de>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 06:59:54 +00:00
nobu 721b55d70c parse.y: reorder in the place
* parse.y (new_args_tail): reorder required and optional keyword
  argument variable IDs in the place.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 06:47:53 +00:00
nobu b6e2c52857 Docs and tests on URI.hierarchical?, URI.absolute?
Improve code coverage and clarify meaning of hierarchical based on RFC
text.

[Fix GH-1846]

From: Xavier Riley <xavriley@hotmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 16:03:59 +00:00
nobu 7506fde3e9 Improve documentation for 'text '.split
The documentation didn't mention trailing spaces and the
example only demonstrated the case with leading spaces.
[Fix GH-1845]

From: Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 16:02:26 +00:00
svn eb02dd3c05 * 2018-03-22
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 15:46:16 +00:00
nobu 365338d9d6 Remove outdated proc.c binding comment.
Passing a proc as the second argument to eval is no longer supported.
[Fix GH-1843]

From: Tieg Zaharia <tieg.zaharia@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 15:46:15 +00:00
nobu 58fbe69a5b parse.y: terminator at continued line
* parse.y (here_document): a continuing line is not the
  terminator.  [ruby-core:86283] [Bug #14621]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 12:40:16 +00:00
nobu 491f523ab1 parse.y: unindent continued line
* parse.y (tokadd_string): stop at continued line in dedented here
  documents, to dedent for each lines before removing escaped
  newlines.  [ruby-core:86236] [Bug #14621]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 10:32:15 +00:00
nobu bc7e5fcb32 test_iseq.rb: disable load_from_binary
* test/ruby/test_iseq.rb (test_to_binary_with_objects): disable
  load_from_binary right now, r62851 seems having a trouble around
  get_insn_info_succinct_bitvector() yet.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 10:06:23 +00:00
svn 538653464b * 2018-03-21
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 02:20:38 +00:00
nobu c700bb1a2b iseq.c: constfied validate_get_insn_info [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 02:20:37 +00:00
nobu b4b3de3e7c node.c: predicates for special NODEs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-20 13:30:57 +00:00
shugo 798316eac2 io.c: Methods of File should not invoke external commands
For security reasons, File.read, File.binread, File.write, File.binwrite,
File.foreach, and File.readlines should not invoke external commands even
if the path starts with the pipe character |.
[ruby-core:84495] [Feature #14245]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-20 09:09:49 +00:00
nobu ce848356ae compile.c: fix ibf_load_code
* compile.c (ibf_load_iseq_each): manage iseq_size to point loaded
  objects in iseq_encoded.  now marking iseq scans iseq_encoded
  directly.

* test/ruby/test_iseq.rb (test_to_binary_with_objects): skip for
  now, but fix argument order of assert_equal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-20 08:36:42 +00:00
tenderlove 9e26858e8c Reverting r62775, this should fix i686 builds
We need to mark default values for kwarg methods.  This also fixes
Bootsnap.  IBF iseq loading needed to mark iseqs as "having markable
objects".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 18:21:54 +00:00
svn c9dee85033 * 2018-03-20
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 15:40:33 +00:00
usa de87b9695f * win32/README.win32: `make up` is only necessary when building from SVN source.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 15:40:32 +00:00
nobu 6916130566 parse.y: NUL-terminate ruby_sourcefile
* parse.y (yycompile): in some cases (warning, error, dtrace,...),
  ruby_sourcefile is expected to be NUL-terminated, so ensure it.

* template/prelude.c.tmpl (prelude_name): NUL-terminate to get rid
  of copying static data.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 14:12:00 +00:00
usa 68f374727a note that patch is required and need to run make up before make
* win32/README.win32: patch(1) is required, and running `make up` before
	  `make` is also required.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 13:04:22 +00:00
nobu 7e199e4156 parse.y: push `do` token info
* parse.y (k_rescue, k_ensure): revert r62838.

* parse.y (k_do, k_do_LAMBDA, k_do_block): push token infos of
  `do`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 12:40:34 +00:00
nobu 5399951b00 parse.y: ignore do indentations
* parse.y (k_rescue, k_ensure): ignore indentations of `do`, it
  is not at the beginning of line usually.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 08:37:12 +00:00
nobu d34bc779a7 parse.y: mismatched indentations at middle
* parse.y (k_rescue, k_ensure, k_when, k_else, k_elsif): warn
  mismatched indentations at keywords in middle of blocks.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 08:21:26 +00:00
nobu 9720136d9c compile.c: arg var index
* compile.c (iseq_set_arguments): determine argument variable
  indexes by the order, not by just IDs.  arguments begin with `_`
  can be duplicate, so by-ID index may result in a wrong value.
  [ruby-core:86159] [Bug #14611]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 04:08:19 +00:00
nobu 62182eb0a4 parse.y: fix duplicate kwrest
* parse.y (f_kwrest): add the variable name as an argument, as
  well as an internal variable.

* parse.y (new_args_tail): now keyword rest argument variable is
  always placed between keyword arguments and block argument, so
  so just reorder required and optional keyword arguments.  no
  longer kwrest duplicates.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 03:16:40 +00:00
nobu c6e50e513c iseq.c: append local var index to name
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 00:32:52 +00:00
svn affd2b76c8 * 2018-03-19
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 00:32:52 +00:00
nobu a65345417d iseq.c: mark kwrest arg
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 00:32:51 +00:00
nobu 0140921523 compile.c: fix function name [ci skip]
* compile.c (ibf_dump_object_object): fix a probable typo in the
  function name, s/lbf/ibf/.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-18 10:41:53 +00:00
watson1978 dce4a3f58c Improve CSV performance
If it will not use special variables (like $1, $&, $`...),
it can improve the performance by using Regexp#match? or String#match? instead of Regexp#=~ or String#=~.

This patch is same idea as https://github.com/ruby/ruby/pull/1836

[Fix GH-1842]

## Environment
* OS : Ubuntu 17.10
* Compiler : gcc version 7.2.0
* CPU : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
* Memory : 16 GB

## TL;DR
Methods     | Before | After  | Speed up
----------- | ------ | ------ | --------
CSV.foreach | 44.825 | 48.201 | 7.5%
CSV#shift   | 45.200 | 49.584 | 9.7%
CSV.read    | 42.968 | 46.853 | 9.0%
CSV.table   | 10.933 | 11.277 | 3.1%

## Before
```
Calculating -------------------------------------
         CSV.foreach     44.825  (± 0.0%) i/s -    228.000  in   5.086576s
           CSV#shift     45.200  (± 0.0%) i/s -    228.000  in   5.044297s
            CSV.read     42.968  (± 0.0%) i/s -    216.000  in   5.027504s
           CSV.table     10.933  (± 0.0%) i/s -     55.000  in   5.031098s
```

## After
```
Calculating -------------------------------------
         CSV.foreach     48.201  (± 0.0%) i/s -    244.000  in   5.062256s
           CSV#shift     49.584  (± 0.0%) i/s -    248.000  in   5.001652s
            CSV.read     46.853  (± 0.0%) i/s -    236.000  in   5.037044s
           CSV.table     11.277  (± 0.0%) i/s -     57.000  in   5.054694s
```

## Benchmark code
```ruby
require 'csv'
require 'benchmark/ips'

CSV.open("/tmp/file.csv", "w") do |csv|
  csv << ["player", "gameA", "gameB"]
  1000.times do
    csv << ['"Alice"', "84.0", "79.5"]
    csv << ['"Bob"', "20.0", "56.5"]
  end
end

Benchmark.ips do |x|
  x.report "CSV.foreach" do
    CSV.foreach("/tmp/file.csv") do |row|
    end
  end

  x.report "CSV#shift" do
    CSV.open("/tmp/file.csv") do |csv|
      while line = csv.shift
      end
    end
  end

  x.report "CSV.read" do
    CSV.read("/tmp/file.csv")
  end

  x.report "CSV.table" do
    CSV.table("/tmp/file.csv")
  end
end
```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-18 10:28:58 +00:00
kazu 01e9d9ac7e Remove duplicated `,` [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-18 06:54:21 +00:00
nobu 8bad3e6b9d IBF works only on x86 platforms now
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-18 03:40:49 +00:00
svn d0b207ee1b * 2018-03-18
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 15:13:40 +00:00
seki 3381ffee1d If host of URI is omitted, make it with IP address.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 15:13:39 +00:00
nobu 2948dc26bd compile.c: resize to align offsets
* compile.c (ibf_dump_align): resize the dump buffer.
  rb_str_modify_expand expands the buffer but not set the length.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 11:42:08 +00:00
nobu aa3b5b14e9 debugging SEGV on Solaris11s
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 09:41:19 +00:00
k0kubun f5fc032eee Remove unused variables
This fixes following warning:

```
test/logger/test_logger.rb:329: warning: assigned but unused variable - read_read
```

[Fix GH-1840]

From: yuuji.yaginuma <yuuji.yaginuma@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 06:41:35 +00:00
k0kubun 38abd83529 Add doc for `opt` parameter of IO#reopen [ci skip]
It can be specified from 2.0. Ref: https://bugs.ruby-lang.org/issues/7103

[Fix GH-1841]

From: yuuji.yaginuma <yuuji.yaginuma@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 06:39:18 +00:00
k0kubun 4b3809114b test_jit.rb: debug cc1 availability
ENV didn't have any useful information.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 06:33:28 +00:00
nobu 86a16b36ae compile.c: align offsets
* compile.c (ibf_dump_align): expand the buffer for alignment.

* compile.c (ibf_dump_iseq_list, ibf_dump_object_list): align as
  ibf_offset_t.  not all processors do not allow unaligned word,
  or larger, access.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 04:46:26 +00:00
nobu 1bf9dec04c string.c: [DOC] split with block [ci skip]
* string.c (rb_str_split_m): [DOC] about split with block.
  [Feature #4780]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 04:13:26 +00:00
k0kubun b83ae7476e misc/ruby-style.el: use spaces for indentation
instead of hard tabs.

[Bug #14246]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 02:37:51 +00:00
nobu 3f8711a092 transform_mjit_header.rb: read output and errors
* tool/transform_mjit_header.rb (MJITHeader.check_code): read
  output and errors than discarding errors.  also cl.exe prints
  the source file name which is a garbage at this time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 02:18:46 +00:00