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

52082 Коммитов

Автор SHA1 Сообщение Дата
ko1 1f4efb9aed rest parameter optimization [Feature #15010]
* vm_args.c: rb_ary_dup(args->rest) to be used at most once during
  parameter setup. [Feature #15010]
  A patch by chopraanmol1 (Anmol Chopra) <chopraanmol1@gmail.com>.

* array.c (rb_ary_behead): added to remove first n elements.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-28 07:06:06 +00:00
hsbt 715666cc28 Fixed test failures in mswin environment at r64555.
[ruby-core:88699][Bug #15035]
  This patch was provided by MSP-Greg.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-28 02:39:22 +00:00
normal 4d9c23772f thread_pthread.h: rename `gvl.acquired' to `gvl.owner' and document
`acquired' was an old boolean variable, but nowadays it is a
rb_thread_t pointer;  "gvl.owner" seems like a more appropriate
name.  And document the contended path including waitq, timer,
and timer_err.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-28 00:24:08 +00:00
normal fcaf874585 thread_pthread.c: document sigwait_th and sigwait_fd [ci skip]
This is an important concept to document, I think.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 23:39:58 +00:00
normal 1b1274f728 thread_pthread.c: fix deadlock on test_thread.rb::test_signal_at_join
Fixes: r64575 ("avoid lock ping-pong in do_gvl_timer & ubf_select")

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 23:29:44 +00:00
eregon 8500714adc Rewrite Etc.sysconf spec to allow nil or Integer for all variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 19:08:38 +00:00
normal e61e6ae587 process.c: fix potential missed wakeups in r64576
Oddly, all existing test cases passed multiple times
before this patch (even with --jit-wait), so this seems
like a difficult failure to prove.

Fixes: r64576 ("process.c: simplify SIGCHLD-based waitpid")

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 18:37:04 +00:00
normal 9d4027b503 process.c: simplify SIGCHLD-based waitpid
Introduce a new rb_thread_sleep_interruptible that does not
execute interrupts before sleeping.  Skipping the interrupt
check before sleep is required for out-of-GVL ruby_waitpid_all
to function properly when setting waitpid_state.ret

Now that ubf_select can be called by the gvl.timer thread
without recursive locking gvl.lock, we can safely use
rb_threadptr_interrupt to deal with waking up sleeping
processes,

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 17:17:13 +00:00
normal 943bf37b10 thread_pthread.c: avoid lock ping-pong in do_gvl_timer & ubf_select
This simplifies the locking logic somewhat.

While we're at it, designate_timer_thread is worthless in
ubf_select because gvl_acquire_common already guarantees there
is a gvl.timer if gvl->waitq is populated.

In the future (for auto-fiber), this will allow using
th->unblock.func for rb_waitpid callers (via rb_sigchld_handler).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 17:17:08 +00:00
svn cda13d8c71 * 2018-08-28
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 16:38:38 +00:00
eregon 5ffa775fac SC_TZNAME_MAX can also be infinite
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 16:38:37 +00:00
svn 293ed16e64 * append newline at EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 16:22:22 +00:00
eregon 2dca35b9b1 Update to ruby/spec@007e908
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 16:22:21 +00:00
svn 58689fa747 * append newline at EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 14:49:57 +00:00
eregon 85d1a8ba3b Update to ruby/spec@a89819d
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 14:49:56 +00:00
eregon 35f2b71ce9 Fix template/fake.rb.in if ENV["RUBYOPT"] is nil
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 14:33:10 +00:00
eregon 5e9cd5208e Fix template/fake.rb.in when external and internal encodings are set
* To be able to run spec/ruby/command_line/dash_encoding_spec.rb
  with the in-repo build.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 14:25:14 +00:00
svn cea7d04732 * append newline at EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 14:25:02 +00:00
eregon 8180b5bfc0 Update to ruby/spec@09fa86c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 14:25:00 +00:00
eregon a641384815 Simplify guards, the behavior seems Linux-specific
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 10:12:41 +00:00
svn 73c8b1ea29 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 10:05:06 +00:00
hsbt 85d461456c Merge master branch from rubygems upstream.
* It's preparation to release RubyGems 3.0.0.beta2 and Ruby 2.6.0
    preview 3.
  * https://github.com/rubygems/rubygems/compare/v3.0.0.beta1...fad2eb15a282b19dfcb4b48bc95b8b39ebb4511f

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 10:05:04 +00:00
normal 3a83ba90c3 hrtime.h: add note explaining current use of uint64_t [ci skip]
[ruby-core:88678]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 08:48:49 +00:00
nobu 50840311de hrtime.h: missing paren
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 05:49:41 +00:00
nobu 995bc9233f hrtime.h: explicit casts to time_t
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 05:48:41 +00:00
nobu 762f44cf49 configure.ac: printf prifix for int64_t
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 05:39:09 +00:00
normal 49a55f28ab thread.c: check interrupts explicitly in select/ppoll blocking regions
The logic around blocking_region_begin is confusing to me,
but the goal of this patch is to ensure rb_sigwait_fd_get
and rb_sigwait_fd_put are matched.

In other words, we don't want a thread to hold sigwait_fd
forever if an exception is raised while calling select()
or ppoll().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 05:32:18 +00:00
svn bab586e787 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 01:30:21 +00:00
svn 6a052fcd04 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 01:30:20 +00:00
hsbt 95e213d354 Merge rdoc-6.1.0.beta1.
* https://github.com/ruby/rdoc/compare/v6.0.4...v6.1.0.beta1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 01:30:18 +00:00
svn 41fb243684 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 00:44:06 +00:00
svn 56ac079e62 * 2018-08-27
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 00:44:05 +00:00
hsbt 867581dd75 Merge psych-3.1.0.pre1.
* Update bundled libyaml-0.2.1 from 0.1.7.
    https://github.com/ruby/psych/pull/368
  * Unify Psych's API: To use keyword arguments with method call.
    https://github.com/ruby/psych/pull/358

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 00:44:04 +00:00
normal e0311eb847 test/ruby/test_io.rb (test_recycled_fd_close): Linux workaround
Arch Linux CI still seems to timeout on this test...

Note, I can't reproduce the failures in these tests on a
FreeBSD 11.1 VM while infinite-looping, even without the
"th.join(0.001)".  It doesn't seem related to the use of
rb_wait_for_single_fd (r64529).

cf. https://rubyci.org/logs/rubyci.s3.amazonaws.com/arch/ruby-trunk/log/20180826T090003Z.fail.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-26 12:41:21 +00:00
normal 70d6c1a102 thread_sync.c: common wakeup_{one,all} implementation
This let us avoid looping in rb_szqueue_max_set, saves us
some lines of code and reduces binary size slightly
(numbers from 32-bit x86):

         text      data     bss     dec     hex filename
before: 91272       392     156   91820   166ac thread.o
 after: 91200       392     156   91748   16664 thread.o

Inspiration from this taken from the FUTEX_WAKE op
of the Linux futex(2) syscall.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-26 12:41:16 +00:00
normal 84859fd2d2 process.c: remove worthless waitpid_sys macro
It is identical to do_waitpid, and the win32 version will not
be needed for MJIT (since win32 does not suffer from the
waitpid(-1, ...) conflict where waits can get stolen.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-26 04:29:11 +00:00
normal 32910b8781 test/io/wait/test_io_wait_uncommon.rb: relax /dev/random check
Too many machines lack entropy to have a usable /dev/random.  I
had similar problems on my system until I started using
haveged(8), but we can't require that for CI.

cf. https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian/ruby-trunk/log/20180825T213003Z.fail.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 22:32:35 +00:00
normal 894847a5de thread_pthread.c (ubf_wakeup_thread): `th' is never NULL
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 22:14:14 +00:00
normal 70a8a6d3eb thread_pthread.c: main thread always gets hit by signals
We need to ensure Signal.trap handlers can function if the main
thread is sleeping after a subthread has grabbed sigwait_fd,
but later exited.

Consider the following timeline:

main_thread             sub-thread
-----------------------------------------
Signal.trap() { ... }
                        get sigwait_fd
                        ppoll on sigwait_fd
native_cond_sleep
(via pthread_cond_wait)
                        ppoll times-out
			put sigwait_fd
                        sub-thread exits

only thread alive
SIGNAL HITS

The problem is pthread_cond_wait cannot return EINTR,
so we can never run the Signal.trap handler.  So we
will avoid using native_cond_sleep in the main thread
and always use ppoll to sleep when in the main thread.
This can guarantee the main thread remains aware of
signals; even if it cannot safely read off sigwait_fd

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 21:59:30 +00:00
svn 49309733e2 * 2018-08-26
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 21:33:55 +00:00
normal b4084d7c36 thread.c: quiet down -Wmaybe-uninitialized on gcc 7.[2-3]
Haven't tested gcc 8, yet; but gcc 6 seems fine....

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 21:33:55 +00:00
normal 95abea43fe hrtime.h: add documentation
I updated the patch with documentation but forgot about it,
earlier :x

[ruby-core:88616] [Misc #15014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 09:02:50 +00:00
svn 0e063601a4 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 06:58:36 +00:00
normal b0253a7569 thread.c: use rb_hrtime_t scalar for high-resolution time operations
Relying on "struct timespec" was too annoying API-wise and
used more stack space.  "double" was a bit wacky w.r.t rounding
in the past, so now we'll switch to using a 64-bit type.

Unsigned 64-bit integer is able to give us over nearly 585
years of range with nanoseconds.  This range is good enough
for the Linux kernel internal time representation, so it
ought to be good enough for us.

This reduces the stack usage of functions while GVL is held
(and thus subject to marking) on x86-64 Linux (with ppoll):

	rb_wait_for_single_fd    120 => 104
	do_select                120 => 88

[ruby-core:88582] [Misc #15014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 06:58:35 +00:00
normal 7c31c2738c drb: close graceful shutdown pipe before socket
Closing a listen socket while entering select(2) may
trigger IOError or even deadlock because another thread
may give the file descriptor to another file description;
meaning the kernel can wait on the wrong description.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 02:32:15 +00:00
normal a48022489f drb: simplify shutdown pipe close logic
IO#close is idempotent, so we don't need to waste bytecode
to check or nil it at shutdown time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 02:32:10 +00:00
naruse 7710bdd120 Add AIX guards
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-24 22:32:07 +00:00
normal 6277b924ea test/ruby/test_io.rb (test_recycled_fd_close): use IO#read to avoid ppoll call
IO#sysread calls rb_wait_for_single_fd for compatibility, and
perhaps something is amiss with that (unrelated to timer-thread
elimination)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-24 20:28:08 +00:00
svn 72af13f3ba * 2018-08-25
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-24 19:19:02 +00:00
normal 0a77fd04b7 thread_pthread.c: use eventfd instead of pipe on Linux
Based on r64478, any regular user creating more than 1024 pipes
on Linux will end up with tiny pipes with only a single page
capacity.  So avoid wasting user resources and use lighter
eventfd on Linux.

[ruby-core:88563] [Misc #15011]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-24 19:19:01 +00:00