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

46820 Коммитов

Автор SHA1 Сообщение Дата
ko1 1dc7906b17 remove arg_setup_lambda.
* vm_args.c (enum arg_setup_type): remove arg_setup_lambda because it is
  same as arg_setup_method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-05 05:43:58 +00:00
nobu 86ae6129cb load.c: encode to OS path outside PUSH_TAG
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-04 07:29:52 +00:00
nobu 0866b8e83a test_require.rb: fix expected path
* test/ruby/test_require.rb (test_require_with_unc): remove extra
  slash.  the result of File.expand_path has a slash just follows
  the drive letter.
  4ef849bd90 (commitcomment-22391133)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-04 06:24:04 +00:00
stomar 7c8a060b85 array.c: docs for Array#{sort,sort!}
* array.c: [DOC] make example in the docs for Array#{sort,sort!}
  match the call-seq and description by using the same block vars.
  Based on a patch by Roque Pinel (repinel).  [Fix GH-1628]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 20:17:00 +00:00
svn 4bf1fc3a13 * 2017-06-04
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 17:11:44 +00:00
nobu 4ef849bd90 test_require.rb: ignore EPERM at UNC
* test/ruby/test_require.rb (test_require_with_unc): ignore EPERM.
  GetFileAttributes and CreateFile with backup semantics fail at a
  symlink in a shared folder to another shared folder.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 17:11:43 +00:00
nobu a75bc36dd2 file.c: preserve encoding
* file.c (path_check_0): preserve encoding of path name in warning
  message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 14:40:05 +00:00
nobu 71b3abeba3 ruby.c: dladdr_path is not used on cygwin
* ruby.c (dladdr_path): dladdr is provided on recent cygwin, but
  GetModuleFileNameW is used instead of it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 12:47:11 +00:00
ko1 26864584d2 * vm_core.h: remove VM_FRAME_MAGIC_LAMBDA and introduce
VM_FRAME_FLAG_LAMBDA. So that lambda block frame is
  VM_FRAME_MAGIC_BLOCK | VM_FRAME_FLAG_LAMBDA.

* vm_core.h: remvoe VM_FRAME_MAGIC_PROC because nobody uses it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 10:07:44 +00:00
nobu 08d44417e0 test/ruby/test_require.rb: remove duplicate assertion
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 09:35:43 +00:00
nobu 0a733176da test_require.rb: untouch default internal encoding
* test/ruby/test_require.rb (assert_require_insecure_path): get
  rid of setting Encoding.default_internal, which affects load
  path conversion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 09:18:44 +00:00
normal e6e292121a test: attempt to reduce failures in assert_cpu_usage_low
Try to make this test less fragile by taking into account
the worst case kernel timing resolution.
[ruby-core:81540]

* test/lib/test/unit/assertions.rb (assert_cpu_usage_low):
  clamp measurement to minimum measurable time and warn
  about tests being too short to measure
* test/ruby/test_io.rb (test_copy_stream_no_busy_wait):
  remove pct kwarg and rely on assert_cpu_usage_low defaults

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 01:04:30 +00:00
stomar 038c2e52d8 string.c: docs for String#split
* string.c: [DOC] clarify docs for String#split when called
  with limit and capture groups.
  Reported by Cichol Tsai.  [ruby-core:81505] [Bug #13621]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 21:29:27 +00:00
svn cd4cbc7bca * 2017-06-03
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 15:38:29 +00:00
nobu 1465400ecb common.mk: show locale
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 15:38:28 +00:00
nobu eb4a2c374e test_require.rb: assert_require_insecure_path
* test/ruby/test_require.rb (assert_require_insecure_path): more
  tests for loading insecure path.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 14:52:49 +00:00
nobu 311e650334 test_require.rb: fallback encoding
* test/ruby/test_require.rb (assert_require_nonascii_path):
  fallback when LANG=C.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 04:32:47 +00:00
nobu 51e738561a test_require.rb: filesystem encoding
* test/ruby/test_require.rb (assert_require_nonascii_path): the
  path in error message is converted to filesystem encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 04:10:36 +00:00
nobu 1e1964b8f2 file.c: preserve encoding
* file.c (rb_find_file_safe): preserve encoding of path in
  SecurityError messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 03:54:19 +00:00
eregon 321300d4e0 Fix DRb.start_service to use any available port
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 17:26:12 +00:00
eregon 96ab53602a Remove bad spec which cannot behave nicely in a multi-process environment
* A system port might be taken by another process at any time.
* There are no useful expectations in this spec.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 17:26:00 +00:00
eregon 630e4fc595 Remove empty files in drb specs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 17:25:48 +00:00
eregon 59609c547d Create the file in the File::TMPFILE spec in its own directory
* Avoids failing the spec if rubyspec_temp is not empty.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 17:08:59 +00:00
eregon 51a38a2401 Open files in binary modes for copying in MSpec's #cp
* See https://bugs.ruby-lang.org/issues/13570.
* Found by MSP-Greg (Greg L).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 17:08:47 +00:00
ko1 b4621c9aae make Dir object WB protected.
* dir.c (dir_data_type): set RUBY_TYPED_WB_PROTECTED.
  Insert WBs for dir_data::path.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 15:18:51 +00:00
svn 44396dbe12 * 2017-06-02
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 15:12:15 +00:00
ko1 9301ef5d0e make Binding object WB protected.
* proc.c (ruby_binding_data_type): set RUBY_TYPED_WB_PROTECTED.
  Insert write barriers (WBs) to all of writes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 15:12:14 +00:00
nobu b9f5cab23a load.c: convert by rb_get_path_check
* load.c (rb_require_internal): convert to path name with the
  given safe level, without setting global safe level.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 13:05:54 +00:00
nobu 31e6dfee6c file.c: rb_check_funcall_default for fallback value
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 12:58:02 +00:00
nobu c4e2e584e0 vm_eval.c: fix rb_check_funcall_default
* vm_eval.c (check_funcall_missing): revert r58984.  should call
  method_missing if respond_to_missing is not redefined.

* vm_eval.c (rb_check_funcall_default): return the default value
  if respond_to_missing and method_missing are not defined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 08:02:41 +00:00
nobu 7c9af2d254 vm_eval.c: fix for rb_check_funcall_default
* vm_eval.c (check_funcall_missing): basic_obj_respond_to_missing
  returns Qundef if respond_to_missing is not redefined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 07:46:22 +00:00
ko1 648e0a9775 fix failure on r58981
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 04:48:05 +00:00
nobu be701dc57f debug.c: more enums
* debug.c (ruby_dummy_gdb_enums): add enums for RObject, RModule,
  RString, RArray.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 04:43:03 +00:00
duerst d0e7329df3 improve English for a warning message
On DOSish systems, there is a warning message for \r\n line endings on shebang line.
Improve this message from "shebang line ends with \r may cause a problem"
to "shebang line ending with \r may cause problems".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 04:38:03 +00:00
svn eb59047e2a * 2017-06-01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 00:05:35 +00:00
ko1 478003f6df rename absolute_path to realpath internally and introduce pathobj.
* vm_core.h: rename absolute_path to realpath because it is expected name.
  external APIs (#absolute_path methods) are remained.

* vm_core.h: remove rb_iseq_location_struct::path and
  rb_iseq_location_struct::absolute_path and introduce pathobj.
  if given path equals to given absolute_path (and most of case
  it is true), pathobj is simply given path String. If it is not same,
  pathobj is Array and pathobj[0] is path and pathobj[1] is realpath.

  This size optimization reduce 8 bytes and
  sizeof(struct rb_iseq_constant_body) is 200 bytes -> 192 bytes
  on 64bit CPU.

  To support this change, the following functions are introduced:
    * pathobj_path() (defined in vm_core.h)
    * pathobj_realpath() (ditto)
    * rb_iseq_path() (decl. in vm_core.h)
    * rb_iseq_realpath() (ditto)
    * rb_iseq_pathobj_new() (ditto)
    * rb_iseq_pathobj_set() (ditto)

* vm_core.h (rb_binding_t): use pathobj instead of path. If binding
  is given at eval methods, realpath (absolute_path) was caller's
  realpath. However, they should use binding's realpath.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 00:05:33 +00:00
watson1978 d0015e4ac6 Improve performance of implicit type conversion
To convert the object implicitly, it has had two parts in convert_type() which are
  1. lookink up the method's id
  2. calling the method

Seems that strncmp() and strcmp() in convert_type() are slightly heavy to look up
the method's id for type conversion.

This patch will add and use internal APIs (rb_convert_type_with_id, rb_check_convert_type_with_id)
to call the method without looking up the method's id when convert the object.

Array#flatten -> 19 % up
Array#+       ->  3 % up

[ruby-dev:50024] [Bug #13341] [Fix GH-1537]

### Before
       Array#flatten    104.119k (± 1.1%) i/s -    525.690k in   5.049517s
             Array#+      1.993M (± 1.8%) i/s -     10.010M in   5.024258s

### After
       Array#flatten    124.005k (± 1.0%) i/s -    624.240k in   5.034477s
             Array#+      2.058M (± 4.8%) i/s -     10.302M in   5.019328s

### Test Code
require 'benchmark/ips'

class Foo
  def to_ary
    [1,2,3]
  end
end

Benchmark.ips do |x|

  ary = []
  100.times { |i| ary << i }
  array = [ary]

  x.report "Array#flatten" do |i|
    i.times { array.flatten }
  end

  x.report "Array#+" do |i|
    obj = Foo.new
    i.times { array + obj }
  end

end

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-31 12:30:57 +00:00
ko1 cc50ed4a50 add debug counters for local variable (lavr) access.
* debug_counter.h: add the following counters:
  * lvar_get: counter for lvar get.
  * lvar_get_dynamic: counter for lvar get from upper frames.
  * lvar_set: coutner for lvar set.
  * lvar_set_dynamic: coutner for lvar set from upper frames.
  * lvar_set_slowpath: counter for lavr set using slowpath.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-31 06:46:57 +00:00
nobu 76bca90c5b Makefile.sub: set ENABLE_SHARED [ci skip]
* win32/Makefile.sub (LIBRUBY_LDSHARED): mswin build always
  enables shared.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-31 06:40:49 +00:00
nobu 0cdfc49d9d common.mk: lldb [ci skip]
* common.mk (lldb, lldb-ruby): add targets to debug with lldb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-31 06:03:13 +00:00
nobu 56abb12f8d lldb_cruby.py: eval outside frames
* misc/lldb_cruby.py (lldb_rp): evaluate without frames when no
  process is running, and show error messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-31 02:42:10 +00:00
svn e003725fc3 * 2017-05-31
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 18:17:56 +00:00
stomar 8bce215fa2 object.c: improve docs
* object.c: [DOC] add an example for Object#yield_self that
  better illustrates its purpose; other small improvements.
  Reported by Vitaly Tatarintsev (ck3g).  Patch by Marcus Stollsteimer.
  [Fix GH-1637]

* object.c: [DOC] improve docs for Object#{itself,tap}.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 18:17:55 +00:00
nobu e4cc791f87 enum.c: check if reentered
* enum.c (cmpint_reenter_check): extract from nmin_cmp and
  nmin_block_cmp.

* enum.c (nmin_cmp): check if reentered before rb_cmpint.
  [Feature #13437]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 13:12:22 +00:00
nobu 7cdb2840df enum.c: rb_check_funcall_default for fallback value
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 12:47:58 +00:00
nobu 76be4743ba test_rubyoptions.rb: ruby-runner sets $0 to install name now
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 11:59:26 +00:00
watson1978 cf02692f3e Improve performance of Enumerable#{sort_by,min_by,max_by,minmax_by}
This is totally same approach with r58964.

enum.c (sort_by_cmp): use OPTIMIZED_CMP() to compare the objects instead of
    `<=>' method dispatching for Fixnum/Float/String object.

enum.c (nmin_cmp): ditto.
enum.c (min_by_i): ditto.
enum.c (max_by_i): ditto.
enum.c (minmax_by_i_update): ditto.
enum.c (minmax_by_i): ditto.

    Enumerable#sort_by   -> 51 % up
    Enumerable#min_by(n) -> 34 % up
    Enumerable#min_by    -> 37 % up
    Enumerable#max_by(n) -> 61 % up
    Enumerable#max_by    -> 40 % up
    Enumerable#minmax_by -> 67 % up

    [ruby-core:80689] [Bug #13437] [Fix GH-1584]

### Before
  Enumerable#sort_by      5.692k (± 2.2%) i/s -     28.611k in   5.028861s
Enumerable#min_by(n)      8.496k (± 0.5%) i/s -     43.146k in   5.078394s
   Enumerable#min_by      8.678k (± 0.5%) i/s -     43.911k in   5.060128s
Enumerable#max_by(n)      3.306k (± 3.0%) i/s -     16.562k in   5.014727s
   Enumerable#max_by      8.322k (± 2.8%) i/s -     42.400k in   5.099400s
Enumerable#minmax_by      6.769k (± 2.6%) i/s -     34.100k in   5.041354s

### After
  Enumerable#sort_by      8.591k (± 3.0%) i/s -     43.316k in   5.046836s
Enumerable#min_by(n)     11.489k (± 1.2%) i/s -     57.732k in   5.025504s
   Enumerable#min_by     11.835k (± 2.7%) i/s -     60.150k in   5.086450s
Enumerable#max_by(n)      5.322k (± 1.1%) i/s -     26.650k in   5.008289s
   Enumerable#max_by     11.705k (± 0.6%) i/s -     59.262k in   5.062997s
Enumerable#minmax_by     11.323k (± 1.3%) i/s -     57.018k in   5.036565s

### Test code
require 'benchmark/ips'

Benchmark.ips do |x|
  enum = (1..1000).to_a.to_enum

  x.report "Enumerable#sort_by" do
    enum.sort_by { |a| a }
  end

  x.report "Enumerable#min_by(n)" do
    enum.min_by(2) { |a| a }
  end

  x.report "Enumerable#min_by" do
    enum.min_by { |a| a }
  end

  x.report "Enumerable#max_by(n)" do
    enum.max_by(2) { |a| a }
  end

  x.report "Enumerable#max_by" do
    enum.max_by { |a| a }
  end

  x.report "Enumerable#minmax_by" do
    enum.minmax_by { |a| a }
  end
end

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 09:00:56 +00:00
ko1 492c88dc3b add parameter names.
* vm_core.h: add parameter names for rb_iseq_new*.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 07:05:58 +00:00
naruse 58d8d65281 Solaris 10 x86 raseis SEGV
http://rubyci.s3.amazonaws.com/unstable10x/ruby-trunk/log/20170527T221806Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 06:50:35 +00:00
duerst 11954049fa Change max byte length of UTF-8 to 4 bytes
In enc/utf_8.c, change maximum byte length of UTF-8 to 4 bytes (from 6)
to conform to definition of UTF-8. This closes issue #13590.
(This is a retry of r58954, after issue #13590 has been addressed.)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 05:43:41 +00:00