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

42721 Коммитов

Автор SHA1 Сообщение Дата
mrkn ad0b5ebc50 * bignum.c (rb_big_to_s, Bignum#to_s): remove its definition because
it is unified with Integer#to_s.

* numeric.c (int_to_s): treat Bignum values directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 12:57:40 +00:00
mrkn a22ff208e5 * numeric.c (int_to_s): Move from flo_to_s.
* numeric.c (Integer#to_s): Move from Fixnum#to_s.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 12:33:28 +00:00
nobu 54c7712081 test_file_exhaustive.rb: strict check test_dirname
* test/ruby/test_file_exhaustive.rb (test_dirname): assert same as
  the parent directory, not ascendant directories.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 08:00:57 +00:00
nobu 764f39210b gc.c: fix r54115
* gc.c (gc_page_sweep): use the argument objspace.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 07:37:07 +00:00
nobu 7a3cc69779 parse.y: Fix for nth_ref_max
* parse.y (parse_numvar): NTH_REF must be less than a half of
  INT_MAX, as it is left-shifted to be ORed with back-ref flag.
  [ruby-core:74444] [Bug#12192] [Fix GH-1296]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 07:22:26 +00:00
nobu b14ed1bb5d file.c: simplify rb_file_s_split
* file.c (rb_file_s_split): use rb_file_dirname instead of
  rb_file_s_dirname with unused Qnil.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 06:59:10 +00:00
nobu 7e81ca14fe gc.c: fix commit miss r54145
* gc.c (tick): fix missing close parenthesis.  [Fix GH-1291]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 03:25:32 +00:00
sonots 5f11a6eb6c * ext/date/date_core.c (datetime_to_time): preserve timezone info
[Bug #12189] [Fix GH-1295]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 01:26:12 +00:00
mrkn f8e79c84a9 * bignum.c (rb_big_hash): make it public function to be available in
other source files, and remove documentation comment for Bignum#hash.

* bignum.c (Bignum#hash): remove its definition because it is unified
  with Object#hash.

* include/ruby/intern.h (rb_big_hash): add a prototype declaration.

* hash.c (any_hash): treat Bignum values directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 01:22:38 +00:00
sonots 1ba62fa93a * lib/time.rb (parse, strptime): Fix Time.parse/strptime does not
have compatibility with DateTime.parse/strptime in terms of parsing
  timezone [Bug #12190] [Fix GH-1297]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 17:46:22 +00:00
mrkn 2169bea82e * numeric.c (fix_zero_p, fix_even_p, fix_odd_p): remove needless
functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 17:17:08 +00:00
mrkn 0a607bc8f8 * numeric.c (int_even_p): treat Fixnum and Bignum values directly.
I forgot include this commit in the previous one.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 17:15:33 +00:00
mrkn aa1ea07d37 * bignum.c (Bignum#even?, Bignum#odd?): remove definitions
because they are unified with Integer#even? and Integer#odd?.

* numeric.c (Fixnum#zero?, Fixnum#even?, Fixnum#odd?): remove
  definitions because they are unified with Numeric#zero?,
  Integer#even?, and Integer#odd?.

* numeric.c (num_zero_p, int_even_p, int_odd_p): treat Fixnum and
  Bignum values directly.

* test/ruby/test_integer.rb (test_odd_p_even_p): remove meaningless
  test case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 17:11:42 +00:00
mrkn a3c9cda6d7 * bignum.c (rb_big_even_p, rb_big_odd_p): make them public functions
to be available in other source files.

* include/ruby/intern.h (rb_big_even_p, rb_big_odd_p): add prototype
  declarations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 17:07:29 +00:00
akr 087a393fa5 * enum.c (ary_inject_op): Implement the specialized code for sum of
float numbers.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 15:27:05 +00:00
svn d3e0891423 * 2016-03-18
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 15:18:59 +00:00
svn 4e42598278 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 15:18:59 +00:00
mame 64a76ee8a8 * numeric.c (num_step): use rb_equal for zero check. rb_num_coerce_cmp
created an object which caused extra overhead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 15:18:59 +00:00
nobu 37153c03f8 ruby.h: remove RB_GC_GUARD_PTR
* include/ruby/ruby.h (RB_GC_GUARD_PTR): remove intermediate
  macro, and expand for each RB_GC_GUARD.  [Fix GH-1293]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 13:21:36 +00:00
nobu e1ee61bfbd compile.c: strict condition
* compile.c (iseq_specialized_instruction): specialize only
  concatenated newarray and send, no labels and no adjusts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 13:19:02 +00:00
nobu 8472c15440 compile.c: move newarray specialization
* compile.c (iseq_specialized_instruction): move specialization
  for opt_newarray_max/min from translation phase.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 13:08:35 +00:00
mame b3a65c883a * array.c, enum.c: make rdoc format consistent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:52:47 +00:00
mame f8e2964065 * NEWS: add Array#max, #min, and the optimization. [Feature #12172]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:49:19 +00:00
mame 3c7c983300 * compile.c (NODE_CALL): add optimization shortcut for Array#max/min.
Now `[x, y].max` is optimized so that a temporal array object is not
  created in some condition.

* insns.def (opt_newarray_max, opt_newarray_min): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:47:31 +00:00
mame 4ca0483a28 * array.c (rb_ary_max, rb_ary_min): implement Array#max and min with
arguments.  replace super call with rb_nmin_run.

* enum.c (nmin_run): exported (as rb_nmin_run).

* internal.h: added a prototype for rb_nmin_run.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:37:20 +00:00
mame 90ab5beb42 * array.c (rb_ary_max, rb_ary_min): implement a block by itself instead
of delegating Enumerable#max/min.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:25:40 +00:00
mame 68a6f2e9e0 * array.c (rb_ary_max, rb_ary_min): Array#max and Array#min added.
[Feature #12172]

* internal.h (OPTIMIZED_CMP): moved from enum.c so that array.c can
  use it.

* test/ruby/test_array.rb (test_max, test_min): tests for Array#max
  and Array#min.

* test/ruby/test_enum.rb (test_max, test_min): revised a bit to test
  Enumerable#max and #min explicitly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:14:21 +00:00
mame a22455199b * internal.c: struct cmp_opt_data added for refactoring out a data
structure for CMP_OPTIMIZABLE

* array.c (struct ary_sort_data): use struct cmp_opt_data.

* enum.c (struct min_t, max_t, min_max_t): use struct cmp_opt_data.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:03:48 +00:00
akr 85473c481e * enum.c (ary_inject_op): Extracted from enum_inject.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 11:55:58 +00:00
akr fa153d7435 * enum.c (enum_inject): Implement the specialized code for sum of
integers including Bignums.

* internal.h (rb_fix_plus): Declared to be usable from enum_inject.

* numeric.c (rb_fix_plus): Defined.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 09:50:19 +00:00
nobu fe9817618d thread_sync.c: Update rdoc for Queue [skip ci]
* thread_sync.c: [DOC] Update documentation for Queue class
  description.  [Fix GH-1292]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 08:20:29 +00:00
nobu a5456a1d83 gc.c: tick for POWER arch
* gc.c (tick): Use __builtin_ppc_get_timebase for POWER arch.
  [Fix GH-1291]

This gives a little performance improvement

        user     system      total        real
Before: 20.870000   0.000000  20.870000 ( 20.893959)
After:  20.720000   0.000000  20.720000 ( 20.733970)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 08:14:53 +00:00
naruse 6545327e24 * lib/securerandom.rb (gen_random): to avoid blocking on Windows.
On Windows OpenSSL RAND_bytes (underlying implementation is
  RAND_poll in crypto/rand/rand_win.c) may be blocked at
  NetStatisticsGet.
  https://wiki.openssl.org/index.php/Random_Numbers#Windows_Issues
  Instead of this, use Random.raw_seed directory (whose implementation
  CryptGenRandom is one of the source of
  entropy of RAND_poll on Windows).
  https://wiki.openssl.org/index.php/Random_Numbers
  Note: CryptGenRandom function is PRNG and doesn't check its entropy,
  so it won't block. [Bug #12139]
  https://msdn.microsoft.com/ja-jp/library/windows/desktop/aa379942.aspx
  https://tools.ietf.org/html/rfc4086#section-7.1.3
  https://eprint.iacr.org/2007/419.pdf
  http://www.cs.huji.ac.il/~dolev/pubs/thesis/msc-thesis-leo.pdf

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 06:01:11 +00:00
nobu 6555077aa0 compile.c: bit flag
* compile.c (LABEL): turn `set` flag a bit field.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 05:47:44 +00:00
nobu 755a81a77a assertions.rb: fix result of assert_nothing_raised
* test/lib/test/unit/assertions.rb (assert_nothing_raised): do not
  discard the result of the given block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 05:22:57 +00:00
nobu 7b2b831959 test_optimization.rb: tailcall
* test/ruby/test_optimization.rb (TestRubyOptimization.tailcall):
  helper method to compile methods with tailcall optimization
  enabled.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 04:31:10 +00:00
duerst fdbb82967f * enc/unicode.c: Fixed two macro definitions.
* test/ruby/enc/test_case_mapping.rb: Test cases that detected
  the above bugs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 03:09:00 +00:00
nobu 551f6b3a18 socket/option.c: accurate condition
* ext/socket/option.c (inspect_tcpi_msec): more accurate condition
  for TCPI msec member inspection function.
  [ruby-core:74388] [Bug #12185]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 02:36:28 +00:00
nobu d90af78f05 test_marshal.rb: assert bad link
* test/ruby/test_marshal.rb (test_marshal_load_r_prepare_reference_crash):
  assert an ArgumentError exception at a bad link.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 01:23:03 +00:00
odaira 82b8840320 * test/-ext-/time/test_new.rb (test_timespec_new): Time#gmtoff values
are the same only when both or neither of the Time objects are in
  summer time (daylight-saving time).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 23:20:14 +00:00
drbrain c9165d0644 * marshal.c (r_object0): raise ArgumentError when linking to undefined
object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 22:18:12 +00:00
mrkn e91e50d05e * test/ruby/test_bignum.rb: Make sure to use Bignum values in the tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 15:53:08 +00:00
svn 208a2ed57d * 2016-03-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 15:04:11 +00:00
nobu 119beb272c transcode-tblgen.rb: chomp invalid line
* tool/transcode-tblgen.rb (citrus_decode_mapsrc): remove newline
  from invalid line in exception messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 15:04:11 +00:00
nobu 3a86385ca3 transcode-tblgen.rb: binary mode
* tool/transcode-tblgen.rb (citrus_decode_mapsrc): read in binary
  mode to deal with non-ascii characters.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 14:51:40 +00:00
nobu cb65717b45 parse.y: symbol literals for alias/undef
* defs/keywords (alias, undef): symbol literals are allowed.
* parse.y (parse_percent): should parse symbol literals for alias
  and undef.  [ruby-dev:47681] [Bug #8851]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 14:10:27 +00:00
svn 5c725ba9fe * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 12:42:16 +00:00
naruse 623dde6ce7 * enc/trans/JIS: update Unicode's notice. [Bug #11844]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 12:42:15 +00:00
nobu 6c7fd3b5cf proc.c: fail symbol proc binding
* proc.c (proc_binding): proc from symbol can not make a binding.
  [ruby-core:74100] [Bug #12137]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 11:03:38 +00:00
duerst 50591a768d * test/ruby/enc/test_case_mapping.rb: Fixed and activated a test for Cherokee.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 09:42:45 +00:00