aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* hijack SIGCHLD handler for internal usenormal2018-06-279-98/+446
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a global SIGCHLD handler to guard all callers of rb_waitpid. To work safely with multi-threaded programs, we introduce a VM-wide waitpid_lock to be acquired BEFORE fork/vfork spawns the process. This is to be combined with the new ruby_waitpid_locked function used by mjit.c in a non-Ruby thread. Ruby-level SIGCHLD handlers registered with Signal.trap(:CHLD) continues to work as before and there should be no regressions in any existing use cases. Splitting the wait queues for PID > 0 and groups (PID <= 0) ensures we favor PID > 0 callers. The disabling of SIGCHLD in rb_f_system is longer necessary, as we use deferred signal handling and no longer make ANY blocking waitpid syscalls in other threads which could "beat" the waitpid call made by rb_f_system. We prevent SIGCHLD from firing in normal Ruby Threads and only enable it in the timer-thread, to prevent spurious wakeups from in test/-ext-/gvl/test_last_thread.rb with MJIT enabled. I've tried to guard as much of the code for RUBY_SIGCHLD==0 using C "if" statements rather than CPP "#if" so to reduce the likelyhood of portability problems as the compiler will see more code. We also work to suppress false-positives from Process.wait(-1, Process::WNOHANG) to quiets warnings from spec/ruby/core/process/wait2_spec.rb with MJIT enabled. Lastly, we must implement rb_grantpt for ext/pty. We need a MJIT-compatible way of supporting grantpt(3) which may spawn the `pt_chown' binary and call waitpid(2) on it. [ruby-core:87605] [Ruby trunk Bug#14867] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "bootstraptest/runner: speed up assert_finish by avoiding sleep"mame2018-06-271-8/+3
| | | | | | | | | | This reverts commit r63754. Many CI servers still use old ruby as base ruby which does not support read_nonblock. https://rubyci.org/logs/www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20180627T013100Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* refactor move logics out of insns.defshyouhei2018-06-272-12/+13
| | | | | | | This is a pure refactoring. I see no difference in this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move function declarations from insns.def to internal.hshyouhei2018-06-273-5/+3
| | | | | | | Just avoid being loose. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bootstraptest/runner: speed up assert_finish by avoiding sleepnormal2018-06-261-3/+8
| | | | | | | We may use IO.select to watch for process exit. This speeds up "make test" by 2 seconds for me. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-06-27svn2018-06-261-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test: skip 2 major unstable tests with MJITk0kubun2018-06-262-0/+5
| | | | | | | | | for CI with cppflags=-DMJIT_FORCE_ENABLE. Since I have no idea to fix this immediately, let me skip this for now and take a look later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit_compile.inc.erb: drop unnecessary variablek0kubun2018-06-252-9/+3
| | | | | | It never becomes `dispatched: true` with the current code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_range.rb: add tests to improve coveragewatson19782018-06-251-0/+14
| | | | | | | This patch will improve the result of line coverage from 91.3% to 95.0%. [Fix GH-1899] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* increase body sizenaruse2018-06-251-1/+1
| | | | | | To try to block writing on travis. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: hide path search error behind verbose()normal2018-06-251-1/+1
| | | | | | | | Before r63744, we let execvp(3) fail instead and it was quiet. The verbosity was causing test_search to fail in test/ruby/test_rubyoptions.rb when PATH is set to /tmp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* comma at the end of enum is a C99ismshyouhei2018-06-251-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: avoid signed pointer comparisons (fix for 32-bit)normal2018-06-251-2/+2
| | | | | | | | ptrdiff_t is a signed type, use uintptr_t instead for unsigned comparisons. This is needed to allow MJIT tests to pass on 32-bit x86 GNU/Linux. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: set PIC flags on clang for FreeBSD and glibcnormal2018-06-251-1/+3
| | | | | | | | | | | | | This seems required on FreeBSD 11.1 (clang 4.0.0) and Debian stretch (clang 3.8.1) for shared libraries. Note: Not checking __linux__ because there are statically-linked Linux distros (I don't know if they can support MJIT). But glibc doesn't support static linking, so we guard on that. Maybe other platforms will need this, too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: avoid execvp PATH lookup in vfork-ed childnormal2018-06-251-7/+24
| | | | | | | | | | | execvp(3) is not async-signal-safe and may alter libc internal states (e.g. those used by malloc). However execv(3) is async-signal-safe as of POSIX.1-2008. So perform the PATH lookup in the parent and use execv(3) in the child. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-06-25svn2018-06-241-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* UNIXSocket#recv_io: trigger GC when out of FDsnormal2018-06-241-1/+27
| | | | | | | | | | | | Make this behavior is consistent with our other FD-allocating methods. EMFILE and ENFILE are not documented nor can I trigger them when using UNIXSocket#recv_io. However, ENOMEM is documented, and I've triggered EMSGSIZE on FreeBSD and truncated messages when an EMFILE condition is hit on my system. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (ruby_fork_ruby): fix race in signal handlingnormal2018-06-241-1/+1
| | | | | | | | | | We must block signals before stopping timer-thread, otherwise signal handing may be delayed until (and if) another signal is received after timer-thread is restarted. [ruby-core:87622] [Bug #14868] [Bug #13916] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_process.rb: skip tests for Bug 14867k0kubun2018-06-241-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (after_fork_ruby): make it a proper functionnormal2018-06-241-1/+6
| | | | | | | Improves readability to me, and there's no point in using macros for this with decent compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/net/http/test_httpresponse.rb: add testcases for net/httpresponsemame2018-06-241-0/+30
| | | | | | | | | This change adds testcases for Response#inspect and #code_type, and improves line coverage of lib/net/http/response.rb (91.8 % to 92.94 %). A patch from @owlworks. https://github.com/ruby/ruby/pull/1898 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/prime.rb: remove unused methodsmame2018-06-241-7/+0
| | | | | | | | | | | | | This change removes TrialDivision#cache, TrialDivision#primes, and TrialDivision#primes_so_far. TrialDivision class is undocumented officially, so this class is used only internally. Yugui san moved prime library from mathn to prime in 2008, and then she might forget to delete these methods. A patch from @shio-phys. https://github.com/ruby/prime/pull/4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-06-24svn2018-06-241-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/test_prime.rb: add testcases of prime librarymame2018-06-241-0/+81
| | | | | | | This change improves line coverage of prime.rb from 86% to 99%. A patch from @shio-phys. https://github.com/ruby/prime/pull/3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: disable calling JIT-ed codek0kubun2018-06-234-2/+14
| | | | | | | | | | | when TracePoint is enabled. We're cancelling JIT-ed code execution AFTER each instruction, but there is no guard before the first insn of method. To prevent spoiling performance, I don't want to modify the JIT-ed code to fix this. So this commit replaces `mjit_enabled` check with `mjit_call_p` check. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (ruby_mimmalloc): add initialize code for USE_GC_MALLOC_OBJ_INFO_DETAILStarui2018-06-231-0/+7
| | | | | | | We often had SEGV in ruby_xfree when USE_GC_MALLOC_OBJ_INFO_DETAILS is 1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: unify the variable name with method namek0kubun2018-06-234-23/+23
| | | | | | | | | | | | `RubyVM::MJIT.enabled?`. It's set to be TRUE even before initialization is finished. So it was actually not "mjit initialized predicate". This flag is also used to check whether JIT-ed code should be called or not, but I'm going to split the responsibility to another flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* spec: skip Process wait specs on MJITk0kubun2018-06-235-104/+117
| | | | | | | until [Bug #14867] is fixed. I want to start running CI with MJIT enabled before fixing the problem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: initial cygwin supportk0kubun2018-06-232-3/+4
| | | | | | | | | | | | | | | thread_pthread.c: Drop pthread_attr_setscope usage. It seems that, at least on Linux and macOS, PTHREAD_SCOPE_PROCESS is not supported and thus PTHREAD_SCOPE_SYSTEM should be used by default. Let's just stop calling this until we find some platform that needs `pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)`. [Misc #14854] From: fd0 (Daisuke Fujimura) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC] Add call signature for {Array,Hash}#any?ktsj2018-06-232-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_settracefunc.rb: fix NoMethodErrorktsj2018-06-231-1/+0
| | | | | | | | * test/ruby/test_settracefunc.rb (test_trace_point_raising_exception_in_bmethod_call): this test run in separate process, so #target_thread? is not defined and it doesn't need target thread check. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: fix infinite loopktsj2018-06-232-4/+19
| | | | | | | | | * vm.c: use EXEC_EVENT_HOOK_AND_POP_FRAME. While exception handling, if an exception is raised in hooks, need to pop current frame and raise this raised exception by hook. [ruby-dev:50582] [Bug #14865] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: fix typo in function namektsj2018-06-231-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-06-23svn2018-06-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.c (native_sleep): do not clear unblock.argnormal2018-06-231-1/+0
| | | | | | | | It is unnecessary to clear unblock.arg once unblock.func is cleared, and unblock_function_clear in thread.c doesn't touch it, either. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove debug printnaruse2018-06-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* check net.core.wmem_default and max instead of tcpnaruse2018-06-221-1/+1
| | | | | | https://travis-ci.org/ruby/ruby/jobs/395416137 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* show net.ipv4.tcp_wmem to debug failure on travisnaruse2018-06-221-1/+1
| | | | | | https://travis-ci.org/ruby/ruby/builds/395318841 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* dir.c: define O_CLOEXEC for older systemsnormal2018-06-221-0/+4
| | | | | | | | | | SuSE 10 has openat(), but not O_CLOEXEC Reported-by: wangpeiwen [ruby-core:87591] [Bug #14864] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (sleep_timespec): avoid needless update w/o spuriuos checknormal2018-06-221-2/+2
| | | | | | | No point in wasting cycles updating the timespec when not checking on spurious wakeups. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove DISABLE_RUBYGEMS from config filesnobu2018-06-225-6/+11
| | | | | | | | | | | | | | * configure.ac: removed DISABLE_RUBYGEMS macro from config.h, not to rebuild everything when the flag changed. * configure.ac, win32/configure.bat: make USE_RUBYGEMS lowercase. * tool/mkconfig.rb: remove RUBYGEMS stuff from rbconfig.rb, not to reconfigure and rebuild all extension libraries. * Makefile.in (CPPFLAGS): enable/disable Rubygems by USE_RUBYGEMS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_range.rb: add a test for endless range's min with comparisonmame2018-06-221-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* range.c: Range#last and #max raises a RangeError if it is endlessmame2018-06-222-5/+15
| | | | | | | Also, Range#min raises an error if it is endless and a comparison method is specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* range.c: Range#size now returns Float::INFINITY if it is endlessmame2018-06-222-4/+10
| | | | | | Fixes [Bug #14699] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* range.c: Range#to_a now raises RangeError if it is endlessmame2018-06-222-0/+28
| | | | | | Fixes [Bug #14845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_vm_t): make sleeper non-volatilenormal2018-06-221-1/+1
| | | | | | | vm->sleeper is never modified in signal handlers or without GVL, so there's no need for volatile hocus-pocus. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-06-22svn2018-06-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_sync.c (rb_mutex_lock): fix deadlocknormal2018-06-221-8/+6
| | | | | | | * thread_sync.c (rb_mutex_lock): fix deadlock [ruby-core:87467] [Bug #14841] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: RubyVM::MJIT.pause / RubyVM::MJIT.resumek0kubun2018-06-212-18/+73
| | | | | | [Feature #14830] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.c: fix non-sleepy timer-thread with forknormal2018-06-201-5/+4
| | | | | | | This fixes bootstraptest/test_fork.rb for systems with sleepy timer thread disabled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e