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

46451 Коммитов

Автор SHA1 Сообщение Дата
nobu 7573452099 math.c (ruby_lgamma_r): reduce duplicate code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-10 00:20:02 +00:00
normal 6ad7c53ba9 test/thread: relax internal implementation check in error message
Queue, SizedQueue, and ConditionVariable internal implementation
should not be tied to using arrays.  Implementation details can
change and I am working on a change to remove the dependency on
arrays (as others may attempt, too) by using ccan/list for the
waiter list.

* test/thread/test_cv.rb (test_dump): remove check for Array
* test/thread/test_queue.rb (test_dump): ditto
  [ruby-core:81001] [Misc #13541]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 19:52:10 +00:00
stomar 257eacee2c date_core.c: fix docs for %Z format
* ext/date/date_core.c: [DOC] fix documentation for %Z format
  of {Date,DateTime}.strftime.

  Reported by Damon Timm.  Based on a patch by nano.
  [ruby-core:79602] [Bug #13231] [Fix GH-1565]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 18:56:22 +00:00
naruse 8972de9ff7 dump stub specifications if nil
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 17:41:10 +00:00
nobu 99871095e6 parse.y: brace after literal arg
* parse.y (symbol, dsym, parser_set_number_literal, parser_yylex):
  set state to END too not only ENDARG and after a literal, so
  that a left brace after it should be a primary block bound to
  the literal, which causes syntax error.
  [ruby-core:81037] [Bug #13547]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 17:20:00 +00:00
nobu 046c94380b parse.y: do after cmdarg in paren
* parse.y (parser_yylex): set state to ENDARG after a string
  literal, so that `do` after a literal should be `do_block` and
  bound to the outer method, as well as a numeric/symbol literal.
  [ruby-core:72482] [Bug #11873]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 17:12:43 +00:00
svn 462e6675d2 * 2017-05-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 17:02:08 +00:00
nobu 92fa667087 test_syntax.rb: test_brace_after_local_variable
* test/ruby/test_syntax.rb (test_brace_after_local_variable):
  another test using braces.  [Bug #11873]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 17:02:07 +00:00
nobu 208240870a string.c: fix r58618
* string.c (unicode_normalize_common): aggregation type cannot be
  initialized with dynamic values, in C89.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 14:11:46 +00:00
duerst a4301ec214 replace hand-written argument check by call to rb_scan_args in unicode_normalize_common
In string.c, replace hand-written argument count check by call to rb_scan_args.
This allows to use rb_funcallv once, rather than using rb_funcall twice.
Thanks to Hanmac (Hans Mackowiak) for the idea, see
https://bugs.ruby-lang.org/issues/11078#note-7.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 11:13:45 +00:00
duerst 88892c8d65 add explanations about status of module UnicodeNormalize
In lib/unicode_normalize/normalize.rb, add explanations and clarifications
about the status of the files and the module. [ci skip]
This is in response to discussions at https://github.com/ruby/spec/pull/433
and https://bugs.ruby-lang.org/issues/5481#note-58.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 10:45:46 +00:00
naruse cc3042a793 Add one more guard to avoid mixing nil into latest_specs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 07:47:28 +00:00
normal 7469699dce fixup r58614 for raspi3 and maybe other systems with odd compile
[ruby-core:81048]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 06:17:01 +00:00
normal 9d09240d9e rb_execution_context_t: move stack, stack_size and cfp from rb_thread_t
The goal is to reduce rb_context_t and rb_fiber_t size
by removing the need to store the entire rb_thread_t in
there.

[ruby-core:81045] Work-in-progress: soon, we will move more fields here.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 05:06:41 +00:00
nobu 62b885b090 Ignore fail on non empty ext and gems [ci skip]
* Makefile.in ({ext,gems}/{distclean,realclean}): ignore fail on
  removal of non empty directories.  these directories should not
  be empty when in-place build.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 02:55:51 +00:00
svn f94b7bcee4 * 2017-05-09
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08 16:00:02 +00:00
kazu 0a1debb87c Add mspec and rubyspec to LEGAL [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08 16:00:00 +00:00
hsbt 15196f4c6d Translate missing rdoc comment for opt_send_without_block.
fix [GH-1608], Patch by @k0kubun

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08 13:14:24 +00:00
nobu ebbe6782c6 separate constdefs.c and constdefs.h
* ext/socket/depend: separate constdefs.c and constdefs.h so that
  only one process will run when parallel building.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08 05:31:02 +00:00
normal 774420eba0 reduce rb_mutex_t size from 80 bytes to 72 bytes on 64-bit
We can use existing RVALUE flags to avoid adding a 4-byte
integer to store a boolean flag.  This integer cost us 8 bytes
due to default (lack of) struct packing on x86-64

* thread_sync.c (MUTEX_ALLOW_TRAP): define as FL_USER1
  (struct rb_mutex_struct): remove allow_trap
  (rb_mutex_lock): adjust for flag check
  (rb_mutex_allow_trap): adjust for flag set/unset

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08 01:59:17 +00:00
svn cdc85aec31 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08 01:59:13 +00:00
normal 60473fe0e3 benchmark/bm_vm2_fiber_switch.rb: check for fiber performance
There are currently no benchmarks for Fiber performance, I
should've committed this years ago when [Feature #10341] was
implemented.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08 01:59:12 +00:00
svn 153aa5af98 * 2017-05-08
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08 00:18:54 +00:00
normal 3586c9e087 reduce rb_mutex_t size from 160 to 80 bytes on 64-bit
Instead of relying on a native condition variable and mutex for
every Ruby Mutex object, use a doubly linked-list to implement a
waiter queue in the Mutex.  The immediate benefit of this is
reducing the size of every Mutex object, as some projects have
many objects requiring synchronization.

In the future, this technique using a linked-list and on-stack
list node (struct mutex_waiter) should allow us to easily
transition to M:N threading model, as we can avoid the native
thread dependency to implement Mutex.

We already do something similar for autoload in variable.c,
and this was inspired by the Linux kernel wait queue (as
ccan/list is inspired by the Linux kernel linked-list).

Finaly, there are big performance improvements for Mutex
benchmarks, especially in contended cases:

measure target: real

name            |trunk  |built
----------------|------:|------:
loop_whileloop2 |  0.149|  0.148
vm2_mutex*      |  0.893|  0.651
vm_thread_mutex1|  0.809|  0.624
vm_thread_mutex2|  2.608|  0.628
vm_thread_mutex3| 28.227|  0.881

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

name            |built
----------------|------:
loop_whileloop2 |  1.002
vm2_mutex*      |  1.372
vm_thread_mutex1|  1.297
vm_thread_mutex2|  4.149
vm_thread_mutex3| 32.044

Tested on AMD FX-8320 8-core at 3.5GHz

* thread_sync.c (struct mutex_waiter): new on-stack struct
  (struct rb_mutex_struct): remove native lock/cond, use ccan/list
  (rb_mutex_num_waiting): new function for debug_deadlock_check
  (mutex_free): remove native_*_destroy
  (mutex_alloc): initialize waitq, remove native_*_initialize
  (rb_mutex_trylock): remove native_mutex_{lock,unlock}
  (lock_func): remove
  (lock_interrupt): remove
  (rb_mutex_lock): rewrite waiting path to use native_sleep + ccan/list
  (rb_mutex_unlock_th): rewrite to wake up from native_sleep
  using rb_threadptr_interrupt
  (rb_mutex_abandon_all): empty waitq
* thread.c (debug_deadlock_check): update for new struct
  (rb_check_deadlock): ditto
  [ruby-core:80913] [Feature #13517]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08 00:18:53 +00:00
nobu 7dae53f371 relative path as VPATH
* common.mk (ripper.c): use relative path as VPATH instead of
  absolute path of the current working directory.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 14:21:10 +00:00
nobu ac08e59b02 parse.y: export rb_parser_fatal for ripper
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 14:03:52 +00:00
nobu fd6853a229 stale targets
* common.mk (update-mspec, update-rubyspec): empty stale targets.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 13:40:56 +00:00
nobu 987508ce56 extract prereq.status
* tool/make-snapshot (package): extract static config values for
  prereq and override dynamic values at runtime.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 13:06:34 +00:00
eregon a319225b4a Update specs to follow newlines added by r58596
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 12:26:25 +00:00
eregon e7ec88a41a Rename spec/README to spec/README.md
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 12:17:21 +00:00
svn 7f9cd73302 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 12:05:45 +00:00
svn 6bc742bc6d * remove trailing spaces, append newline at EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 12:05:36 +00:00
eregon 95e8c48dd3 Add in-tree mspec and ruby/spec
* For easier modifications of ruby/spec by MRI developers.
* .gitignore: track changes under spec.
* spec/mspec, spec/rubyspec: add in-tree mspec and ruby/spec.
  These files can therefore be updated like any other file in MRI.
  Instructions are provided in spec/README.
  [Feature #13156] [ruby-core:79246]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 12:04:49 +00:00
eregon ed7d803500 make update-rubyspec is no longer needed
* Kept a no-op for compatibility.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 12:01:26 +00:00
eregon 538dcb3044 Update README about ruby/spec
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 12:01:12 +00:00
eregon e9628d9770 * spec/default.mspec: only require rbconfig if is it not already.
Useful when running spec/mspec/bin/mspec directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 12:00:58 +00:00
normal 95f135960f vm_core.h (rb_thread_t): use 32-bit running_time_us
The current range based current values of:

	TIME_QUANTUM_USEC=100000
	RUBY_THREAD_PRIORITY_MAX=3
	RUBY_THREAD_PRIORITY_MIN=-3

Gives a range of 12500..800000, plenty enough for a 32-bit
integer.  Clamping this also reduces potential implementation
bugs between 32-bit and 64-bit platforms.

I may consider a further reduction to uint16_t in the future
for M:N threading, but some users may want slightly larger
time quantums.

* vm_core.h (rb_thread_t): use 32-bit running_time_us

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 08:06:02 +00:00
normal b1bb2520c8 io.c (do_fcntl): update max FD for F_DUPFD_CLOEXEC, too
Somebody may pass 1030 (the value of F_DUPFD_CLOEXEC) to IO#fcntl
because they copied code from somewhere else.  Ensure we know
about FDs created that way.

* io.c (do_fcntl): update max FD for F_DUPFD_CLOEXEC, too

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 07:38:30 +00:00
stomar a0da514102 NEWS: Integer#{round,floor,ceil,truncate} [Bug #13420]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 07:18:10 +00:00
svn 8451d3c723 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 04:26:38 +00:00
normal c7ff36c6f0 variable.c: cleanup waitq upon thread death
* variable.c (autoload_reset): use idempotent list_del_init
  (autoload_sleep): moved code from rb_autoload_load
  (autoload_sleep_done): cleanup for use with rb_ensure
  (rb_autoload_load): ensure list delete happens in case the
  thread dies during sleep
* test/ruby/bug-13526.rb: new script for separate execution
* test/ruby/test_autoload.rb (test_bug_13526): new test
  [ruby-core:81016] [Bug #13526]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 04:26:37 +00:00
stomar f495fe4fc0 make Integer#{round,floor,ceil,truncate} always return integer
* numeric.c (int_round): return integer (self) instead of float
  for Integer#round with positive ndigits argument, because
  conversion to float introduces errors for large integers.
* numeric.c (int_floor): ditto for Integer#floor.
* numeric.c (int_ceil): ditto for Integer#ceil.
* numeric.c (int_truncate): ditto for Integer#truncate.

* test/ruby/test_integer.rb: adjust test cases and add some more.

[ruby-core:80645] [Bug #13420]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 19:58:12 +00:00
svn 7c0dcecb39 * 2017-05-07
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 15:14:59 +00:00
nobu 4671737b0f ripper/lexer.rb: nested indented heredoc
* ext/ripper/lib/ripper/lexer.rb (on_heredoc_dedent): insert
  stripped leading spaces as `on_ignored_sp` elements, so that the
  original source can be reconsructed.
  [ruby-core:80977] [Bug #13536]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 15:14:58 +00:00
nobu 8727dce2bf fix up r58573
* common.mk: make the directory for extension shared library with
  the timestamp directory.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 14:12:30 +00:00
stomar 4b5a2b5272 math.c: improve docs for Math.sqrt
* math.c: [DOC] mention Integer.sqrt in docs for Math.sqrt.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 07:28:40 +00:00
stomar 5e58811bc8 numeric.c: remove mention of Bignum from docs
* numeric.c: [DOC] remove mention of Bignum from Integer#{+,-,*,/},
  the return type does not depend on magnitude anymore.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 07:18:49 +00:00
stomar f280556f73 numeric.c: revise docs
* numeric.c: [DOC] revise docs for Numeric, Integer, Float:
  * nodoc Numeric#singleton_method_added
  * mention that result for Integer#** might also be Complex
  * add / simplify / fix some examples
  * mention aliases
  * fix rdoc formatting, typos, grammar
  * clarifications and other improvements

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 07:17:41 +00:00
duerst f86766970f delete enc/prelude.rb, because no longer needed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 04:42:58 +00:00
duerst c7baa31c76 delete lib/unicode_normalize.rb, because no longer needed
(all content has been moved to string.c)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 03:12:26 +00:00