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

809 Коммитов

Автор SHA1 Сообщение Дата
nobu f5183827dc thread.c: fix deadlock
* thread.c (thread_join_sleep): the target thread may exit during
  `RUBY_VM_CHECK_INTS_BLOCKING`, but `sleep_forever` does not
  consider the condition change to wait.
  [ruby-core:84248] [Bug #14181]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-15 07:27:04 +00:00
nobu 20c3237d14 thread.c: debug messages
* thread.c (terminate_all): fix funtion name in debug messages.

* thread.c (terminate_all, thread_join_sleep, thread_join): show
  the status of the target thread in debug messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-15 03:07:10 +00:00
eregon 2e315baf48 The main Thread should have report_on_exception=true for consistency
* Adapt test and add specs.
* See [Feature #14143] [ruby-core:84227]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 13:08:02 +00:00
eregon 186732f46f Document how to deal with output created by Thread.report_on_exception.
* Improve and clarify the documentation of Thread.report_on_exception
  and related methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-13 15:59:26 +00:00
eregon 5a3c024df0 Set Thread.report_on_exception=true by default to report exceptions in Threads
* [Feature #14143] [ruby-core:83979]
* vm.c (vm_init2): Set Thread.report_on_exception to true.
* thread.c (thread_start_func_2): Add indication the message is caused
  by report_on_exception = true.
* spec/ruby: Specify the new behavior.
* test/ruby/test_thread.rb: Adapt and improve tests for
  Thread.report_on_exception and Thread#report_on_exception.
* test/ruby/test_thread.rb, test/ruby/test_exception.rb: Unset
  report_on_exception for tests expecting no extra output.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 18:43:42 +00:00
mame 55f93cb63f vm_core.h (RUBY_EVENT_COVERAGE_BRANCH): renamed
This change moves RUBY_EVENT_COVERAGE from include/ruby/ruby.h to
vm_core.h and renames it to RUBY_EVENT_COVERAGE_BRANCH.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 07:19:17 +00:00
mame c3c0c0745f thread.c (update_branch_coverage): renamed from `update_coverage`
Now this function only deals with branch events, so this change renames
it and remove complexity that is no longer needed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 07:04:48 +00:00
mame ec02c4861b thread.c (update_line_coverage): Use RUBY_EVENT_LINE
This change makes coverage use the general event type RUBY_EVENT_LINE
instead of a special event type RUBY_EVENT_COVERAGE.
Just a refactoring.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 06:39:05 +00:00
ko1 0e34638f79 remove `PUSH_TAG`/`EXEC_AG`/`POP_TAG`/`JUMO_TAG`.
* eval_intern.h: remove non-`EC_` prefix *_TAG() macros.
  Use `EC_` prefix macros explicitly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 03:16:08 +00:00
mame a5e02f249d vm_core.h (rb_iseq_locatoin_t): add a field `code_range`
This change makes each ISeq keep NODE's code range.  This information is
needed for method coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05 08:56:50 +00:00
mame 0a6816ecd7 Revamp method coverage to support define_method
Traditionally, method coverage measurement was implemented by inserting
`trace2` instruction to the head of method iseq.  So, it just measured
methods defined by `def` keyword.

This commit drastically changes the measuring mechanism of method
coverage; at `RUBY_EVENT_CALL`, it keeps a hash from rb_method_entry_t*
to runs (i.e., it counts the runs per method entry), and at
`Coverage.result`, it creates the result hash by enumerating all
`rb_method_entry_t*` objects (by `ObjectSpace.each_object`).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05 07:16:42 +00:00
yui-knk 4a73890189 thread.c: Update documents
* thread.c (rb_default_coverage): Update documents of internal
  data structures for branch coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-23 11:52:36 +00:00
ko1 f4cb93adca make funcs static.
* thread.c (rb_threadptr_trap_interrupt): make it static
  and remove `rb_` prefix.

* thread.c (rb_threadptr_pending_interrupt_active_p): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 08:48:59 +00:00
ko1 a3071ea4e3 remove rb_thread_t::event_hooks.
* vm_core.h (rb_thread_t): remove rb_thread_t::event_hooks.

* vm_trace.c: all hooks are connected to vm->event_hooks and
  add rb_event_hook_t::filter::th to filter invoke thread.
  It will simplify invoking hooks code.

* thread.c (thread_start_func_2): clear thread specific trace_func.

* test/ruby/test_settracefunc.rb: add a test for Thread#add_trace_func.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 13:21:24 +00:00
nobu e5b968f571 thread.c: use ec
* thread.c (call_without_gvl): use execution context for
  RUBY_VM_CHECK_INTS_BLOCKING.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 05:50:10 +00:00
mame a798e49f57 Symptomatic treatment for `rb_thread_terminate_all` freeze
Under uncertain condition, `rb_thread_terminate_all` gets stuck.  `make
test-all TESTOPTS="test/ruby/test_gc.rb -n test_interrupt_in_finalizer`
fails very rarely (only once every thousand runs).  This IS a bug, but
seems difficult to fix it soon.

This commit makes `rb_thread_terminate_all` wake up every one second,
instead of waiting forever, which mitigates the unuseful freeze.
This is not an essential solution for the bug, though.  I'll create a
ticket with how to reproduce the original issue.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 06:36:07 +00:00
ko1 f6c102e6a5 th->ec: rb_threadptr_setup_exception
* eval.c (rb_threadptr_setup_exception): renamed to rb_ec_setup_exception().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 06:09:47 +00:00
ko1 ee189904f0 rename to rb_ec_set_raised().
* thread.c (rb_threadptr_set_raised): rename to rb_ec_set_raised
  and accepts `ec`


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 05:12:39 +00:00
ko1 b6ecdf5fc8 th->ec: rb_threadptr_reset_raised()
* thread.c (rb_threadptr_reset_raised): rename to `rb_ec_reset_raised`
  and accepts `ec`.

* vm_trace.c: the following functions accept `ec` instead of `th`
  * exec_hooks_body
  * exec_hooks_precheck
  * exec_hooks_unprotected
  * exec_hooks_protected


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 04:01:13 +00:00
ko1 5dfdaa9299 move rb_thread_t::interrupt_flag and mask
to rb_execution_context_t.

* vm_core.h (rb_thread_t): move
  `rb_thread_t::interrupt_flag` and
  `rb_thread_t::interrupt_mask` to rb_execution_context_t.

  RUBY_VM_CHECK_INTS() accepts `ec` instead of `th`.

* cont.c (rb_fiber_terminate): to propagate interrupt information,
  add new parameter `need_interrupt`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-06 07:44:28 +00:00
ko1 e5e735549d renmae ec::fiber to ec::fiber_ptr.
* vm_core.h (rb_execution_context_t): renmae ec::fiber to
  ec::fiber_ptr make consistent with ec::thread_ptr.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-06 05:41:48 +00:00
ko1 a93c650312 `rb_ec_error_print()`.
* eval_error.c (rb_threadptr_error_print): renamed to
  rb_ec_error_print() and it accepts `ec`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 14:06:58 +00:00
ko1 a288b87c4c EXEC_EVENT_HOOK(ec, ...)
* vm_core.h (EXEC_EVENT_HOOK): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 13:19:14 +00:00
ko1 ad1b64d35d `th` -> `ec` for backtrace functions.
* vm_backtrace.c: accept `ec` and rename `threadptr` to `ec`.
  * rb_threadptr_backtrace_object -> rb_ec_backtrace_object
  * rb_threadptr_backtrace_str_ary -> rb_ec_backtrace_str_ar
  * rb_threadptr_backtrace_location_ary -> rb_ec_backtrace_location_ary
  * threadptr_backtrace_to_ary -> ec_backtrace_to_ary

* vm_eval.c (adjust_backtrace_in_eval): accepts `ec`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 13:22:04 +00:00
ko1 88910e94a8 `th` -> `ec` for block related functions.
* vm.c: the following functions accept `ec` instead of `th`.
  * invoke_block
  * invoke_bmethod
  * invoke_iseq_block_from_c
  * invoke_block_from_c_bh
  * check_block_handler
  * vm_yield_with_cref
  * vm_yield
  * vm_yield_with_block
  * vm_yield_force_blockarg
  * invoke_block_from_c_proc
  * vm_invoke_proc
  * vm_invoke_bmethod
  * rb_vm_invoke_proc

* vm_insnhelper.c: ditto.
  * vm_yield_with_cfunc
  * vm_yield_with_symbol
  * vm_callee_setup_block_arg
  * vm_yield_setup_args
  * vm_invoke_iseq_block
  * vm_invoke_symbol_block
  * vm_invoke_ifunc_block
  * vm_invoke_block


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27 06:06:31 +00:00
ko1 f56288d7a8 replace `GET_THREAD()->ec` to `GET_EC()`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 14:44:09 +00:00
ko1 4552f74715 introduce EC_*_TAG() instead of TH_*_TAG()
* eval_intern.h:
  introduce EC_*_TAG() macros instead of TH_*_TAG() macros.
  * TH_PUSH_TAG() -> EC_PUSH_TAG()
  * TH_POP_TAG() -> EC_POP_TAG()
  * TH_TMPPOP_TAG() -> EC_TMPPOP_TAG()
  * TH_REPUSH_TAG() -> EC_REPUSH_TAG()
  * TH_EXEC_TAG() -> EC_EXEC_TAG()
  * TH_JUMP_TAG() -> EC_JUMP_TAG()

  rb_threadptr_tag_state() , rb_ec_tag_jump() also accept `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 11:02:13 +00:00
ko1 837fd5e494 Use rb_execution_context_t instead of rb_thread_t
to represent execution context [Feature #14038]

* vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer.
  There are many code using `th` to represent execution context
  (such as cfp, VM stack and so on). To access `ec`, they need to
  use `th->ec->...` (adding one indirection) so that we need to
  replace them by passing `ec` instead of `th`.

* vm_core.h (GET_EC()): introduced to access current ec. Also
  remove `ruby_current_thread` global variable.

* cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of
  rb_context_t::thread_value.

* cont.c (ec_set_vm_stack): added to update vm_stack explicitly.

* cont.c (ec_switch): added to switch ec explicitly.

* cont.c (rb_fiber_close): added to terminate fibers explicitly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 08:32:49 +00:00
nobu 6b818dd961 common conversion functions
* array.c (rb_to_array_type): make public to share common code
  internally.

* hash.c (rb_to_hash_type): make public to share common code
  internally.

* symbol.c (rb_to_symbol_type): make public to share common code
  internally.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 07:23:23 +00:00
hsbt 0e2d2e6a79 Drop to support NaCl platform.
Because NaCl and PNaCl are already sunset status.
  see https://bugs.chromium.org/p/chromium/issues/detail?id=239656#c160

  configure.ac: Patch for this file was provided by @nobu.

  [Feature #14041][ruby-core:83497][fix GH-1726]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23 05:56:25 +00:00
sonots 1aad241ae8 thread.c: Use 'Class.new' instead of 'Class::new' in doc codes.
patched by Herwin [Fix GH-1700]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-25 06:05:52 +00:00
nobu ab81cc4d80 thread.c: report then abort
* thread.c (thread_start_func_2): report then abort on exception,
  if both are set.  [ruby-core:79280] [Bug #13163]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-19 02:42:08 +00:00
yui-knk 9d899615d1 thread.c: Clear an array for method coverage
* thread.c (reset_coverage_i): Clear an
  array for method coverage just like
  line coverage and branch coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-18 05:17:21 +00:00
mame 78cf46078e Add method coverage
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 05:12:34 +00:00
mame ce570370f0 Add branch coverage for if statement
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 03:25:36 +00:00
mame d1b290d5ba Add a new instruction `trace2` for hooking with custom data
This is needed for passing to the hook function the measuring target
type (line/branch/method) and the site of coverage event fired.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 01:55:30 +00:00
ko1 4f0c9a5cc4 move th->machine to ec->machine.
* vm_core.h: move rb_thread_t::machine to rb_execution_context_t::machine.

* vm_core.h, gc.c (rb_gc_mark_machine_stack): accept ec instead of th.
  it enables to call this func from rb_execution_context_mark() in vm.c.

* cont.c (fiber_setcontext): catch up this fix.
  fiber_restore_thread() restores machine stack information too.

* gc.c: catch up structure layout changes.

* thread.c: ditto.

* thread_pthread.c: ditto.

* thread_win32.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-10 15:49:45 +00:00
mame cd6df5fb3c Refactor the internal data format for coverage measurement
To prepare new measuring targets: branch and method coverages.
So far, iseq->coverage was an array of counts executed for line coverage.
Now, it is a three-element array for each measuring target,
whose first element is an array for line coverage.
The second element is planned for branch coverage, and the third will be
for method coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-03 14:26:06 +00:00
nobu 19d692920d thread_win32.c: set thread name
* thread_win32.c (native_set_another_thread_name): set thread name
  by SetThreadDescription.

* win32/win32.c (rb_w32_set_thread_description): dynamically try
  SetThreadDescription.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-26 00:30:03 +00:00
ko1 6881279149 rename rb_execution_context_t::stack(_size) to vm_stack(_size).
* vm_core.h: Ruby processes run with two stacks, a machine stack and a
  VM stack. To make it clear, this fix renames
  rb_execution_context_t::stack(_size) to vm_stack(_size).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-10 04:55:12 +00:00
ko1 27535987be Define Thread#to_s (as Thread#inspect) and make alias `inspect` as `to_s`.
* thread.c: "Thread#to_s" is not defined without any reason. So this fix
  define "Thread#to_s" which returns a string with some thread information.
  Also this fix makes alias "inspect" which refers "to_s". This manner is
  same as other objects.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-10 03:20:39 +00:00
ko1 92f7813ae2 release VM stack properly.
* cont.c: r55766 change the handling method of Fiber's VM stack.
  Resumed Fiber points NULL as VM stack and running Thread has
  responsibility to manage it (marking and releasing).

  However, thread_start_func_2()@thread.c and thread_free()@vm.c
  doesn't free the VM stack if corresponding root Fiber is exist.
  This causes memory leak. [Bug #13772]

* cont.c (root_fiber_alloc): fib->cont.saved_thread.ec.stack should be NULL
  because running thread has responsibility to manage this stack.

* vm.c (rb_thread_recycle_stack_release): assert given stack is not NULL
  (callers should care it).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-02 00:50:42 +00:00
ko1 8dd9c12c58 move fields to ec.
* vm_core.h (rb_thread.h): move errinfo and trace_arg to
  rb_execution_context_t.

* cont.c (fiber_switch, rb_cont_call): do not restore "trace_arg" here.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 14:27:49 +00:00
ko1 957d1ccdf9 move fields to ec.
* vm_core.h (rb_thread_t): move root_lep, root_svar and ensure_list
  to rb_execution_context_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 06:09:06 +00:00
ko1 249790802d introduce rb_thread_ptr() to replace GetThreadPtr().
* vm_core.h (rb_thread_ptr): added to replace GetThreadPtr() macro.

* thread.c (in some functions: use "target_th" instead of "th" to make clear
  that it is not a current thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 04:49:30 +00:00
ko1 d98afe3ae2 move storages to ec.
* vm_core.h (rb_thread_t): move storages to rb_execution_context_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 02:50:56 +00:00
ko1 1939d097e6 move several fields from rb_thread_t to rb_execution_context_t.
* vm_core.h (rb_thread_t): move several fields which are copied at cont.c
  to rb_execution_context_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-26 07:56:44 +00:00
ko1 a90c696b8b rb_catch_protect() accepts enum ruby_tag_type *.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 08:24:54 +00:00
nobu 769ef81ae3 thread.c: suppress warning
* thread.c (exec_recursive): rb_catch_protect() uses `int*` as
  well as rb_protect.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 07:53:07 +00:00
ko1 2108e55c0b use "enum ruby_tag_type" and TAG_NONE.
Return value of EXEC_TAG() is saved by "int state".
Instead of "int", use "enum ruby_tag_type". First EXEC_TAG()
value should be 0, so that define TAG_NONE (= 0) and use it.

Some code used "status" instead of "state". To make them clear,
rename them to state.

We can change variable name from "state" to "tag_state", but this
ticket doesn't contain it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 07:25:52 +00:00
ko1 f06daf167b remove rb_blocking_region_buffer::oldubf.
* thread.c (rb_blocking_region_buffer): remove oldubf because ubf should be
  NULL just before ubf setting.

* thread.c (set_unblock_function, reset_unblock_function): rename to
  unblock_function_set() and unblock_function_clear() respectively.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-12 07:49:33 +00:00
ko1 6c3f1461cd remove ruby_kill() introduced for [Bug #7951].
* thread.c (rbuy_kill): removed. This function is used
  with SIGSEGV, SIGBUS, SIGKILL, SIGILL, SIGFPE and SIGSTOP
  and these signals are affect immediately. So that `kill(2)'
  is enough for them.

* signal.c (rb_f_kill): ditto.

* vm_core.h (rb_thread_t::interrupt_cond): removed because
  only `ruby_kill()' uses this field.

* test/ruby/test_signal.rb: Without this patch sending SIGSTOP to own
  process wait another interrupt even if another process sends SIGCONT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-12 04:52:25 +00:00
nobu e8c6254680 thread_pthread.c: workaround for valgrind on Mac
* thread.c: revert r59053.

* thread_pthread.c (rb_thread_create_timer_thread): needs more
  stack space for valgrind.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-09 14:42:15 +00:00
nobu 9abe121c9f thread.c: workaround for valgrind on Mac OS X
Without this hack, pthread_join() in rb_thread_stop_timer_thread()
segfaults.

ProductName:	Mac OS X
ProductVersion:	10.11.6
BuildVersion:	15G1510
valgrind-3.12.0

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-09 13:58:09 +00:00
normal 27b8ef7ff7 thread.c: avoid busy looping on rb_thread_fd_close
We no longer use it this function, but extensions do, and
we need to ensure it continues to work for them.

* thread.c (rb_thread_fd_close): schedule other threads in loop
* ext/-test-/thread_fd_close/thread_fd_close.c: new file
* ext/-test-/thread_fd_close/depend: ditto
* ext/-test-/thread_fd_close/extconf.rb: ditto
* test/-ext-/thread_fd_close/test_thread_fd_close.rb: new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-07 00:32:02 +00:00
normal 10421fb1f2 IO#close: do not enqueue redundant interrupts (take #2)
Enqueuing multiple errors for one event causes spurious errors
down the line, as reported by Nikolay Vashchenko in
https://bugs.ruby-lang.org/issues/13632

This should fix bad interactions with test_race_gets_and_close
in test/ruby/test_io.rb since we ensure rb_notify_fd_close
continues returning the busy flag after enqueuing the interrupt.

Backporting changes to 2.4 and earlier releases will be more
challenging...

* thread.c (rb_notify_fd_close): do not enqueue multiple interrupts
  [ruby-core:81581] [Bug #13632]
* test/ruby/test_io.rb (test_single_exception_on_close):
  new test based on script from Nikolay

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 22:55:35 +00:00
ko1 7d041e87c6 re-revert r59020
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 07:11:28 +00:00
ko1 e9c440815e revert r59023 because it contans unrelated developping code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 07:10:19 +00:00
ko1 b0c9215f72 revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 06:58:54 +00:00
normal 59fb92971f IO#close: do not enqueue redundant interrupts
Enqueuing multiple errors for one event causes spurious errors
down the line, as reported by Nikolay Vashchenko in
https://bugs.ruby-lang.org/issues/13632

* thread.c (rb_notify_fd_close): do not enqueue multiple interrupts
  [ruby-core:81581] [Bug #13632]
* test/ruby/test_io.rb (test_single_exception_on_close):
  new test based on script from Nikolay

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 00:13:47 +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
normal b3d126d5de rb_wait_for_single_fd: do not OOM or segfault with invalid FD on select()
Instead, match the poll() implementation used on Linux for now;
as the Linux poll(2) manpage describes using negative FD to
easily ignore an FD in a larger FD set while (sleeping the given
timeout).  I'm not entirely sure if matching poll() behavior
is a good idea for a single FD, but it's better than segfaulting
or NoMemoryError.

* thread.c (init_set_fd): ignore negative FD
* test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb
  (test_wait_for_invalid_fd): check values which may trigger
  segfaults or OOM

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27 08:26:47 +00:00
normal 508091d9cc speed up IO#close with many threads
Today, it increases IO#close performance with many threads:

  Execution time (sec)
  name            trunk   after
  vm_thread_close 4.276   3.018

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

This speedup comes because rb_notify_fd_close only scans threads
inside rb_thread_io_blocking_region, not all threads in the VM.

In the future, this type data structure may allow us to notify
waiters of multiple FDs on a single thread (when using
Fibers).

* thread.c (struct waiting_fd): declare
  (rb_thread_io_blocking_region): use on-stack list waiter
  (rb_notify_fd_close): walk vm->waiting_fds instead
  (call_without_gvl): remove old field setting
  (th_init): ditto
* vm_core.h (typedef struct rb_vm_struct): add waiting_fds list
* (typedef struct rb_thread_struct): remove waiting_fd field
  (rb_vm_living_threads_init): initialize waiting_fds list

I am now kicking myself for not thinking about this 3 years ago
when I introduced ccan/list in [Feature #9632] to optimize this
same function :<

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 09:47:14 +00:00
nobu 665333e314 thread_win32.c: disable currently unused functions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-13 01:16:36 +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
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
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
nobu ff2422d77c thread.c: suppress warnings [ci skip]
* thread.c (fill_thread_id_string): cast to void pointer to
  suppress warnings when pthread_t is not pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-01 15:17:32 +00:00
nobu 5b3c9fc962 Get rid of unnecessary GCC extension
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-24 04:20:02 +00:00
nobu 5651313b85 vm_dump.c: non-scalar thread_id
* vm_dump.c (rb_vmdebug_stack_dump_all_threads): fix for
  non-scalar thread_id platforms.  c.f. [Bug #9884]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 00:53:26 +00:00
nobu e601e77590 eval.c: copy special exceptions before raise
* eval.c (setup_exception): consider if the exception is frozen,
  but not one of special exception objects.

* gc.c (rb_memerror): copy minimum objects.

* thread.c (rb_threadptr_execute_interrupts): prepare special
  exception queued by another thread to be raised.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 02:31:35 +00:00
nobu e97ac02f84 vm_insnhelper.c: rb_threadptr_stack_overflow
* vm_insnhelper.c (rb_threadptr_stack_overflow): move from
  thread.c and integrate with vm_stackoverflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 02:08:41 +00:00
nobu 269421084e vm_backtrace.c: backtrace functions per threads
* vm_backtrace.c (rb_threadptr_backtrace_object): rename and
  extern.

* vm_backtrace.c (rb_threadptr_backtrace_str_ary): rename as
  threadptr since the parameter is rb_thread_t*.

* vm_backtrace.c (rb_threadptr_backtrace_location_ary): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 01:23:50 +00:00
ko1 c50afaa1c9 disable rewind hooks.
* vm.c (hook_before_rewind): skip rewind hooks if err is SystemStackError
  because rewind hooks can cause stack overflow again and again.

* thread.c (ruby_thread_stack_overflow): do not disable all hooks.
  Additionally, clearing ruby_vm_event_flags is not suitable way
  to disable hooks.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-14 07:46:11 +00:00
nobu 38174633e2 thread.c: disable VM events when stack overflow
* thread.c (ruby_thread_stack_overflow): disable VM events when
  stack overflow occurred; it causes another stack overflow again
  in making backtrace object, and crashes.
  [ruby-core:80662] [Bug #13425]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-13 07:38:23 +00:00
nobu a1caed95cb thread.c: during GC for thread
* thread.c (ruby_thread_stack_overflow): check if the given thread
  is during GC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-12 14:47:50 +00:00
nobu f9ca643683 thread.c: refine stream closed message
* thread.c (Init_Thread): [EXPERIMENTAL] refine the "stream
  closed" special exception message, by explicating that it is
  caused by threading.  [ruby-core:80583] [Bug #13405]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-09 05:09:44 +00:00
nobu 301143273a vm_core.h: ruby_error_stream_closed
* vm_core.h (ruby_special_exceptions): renamed
  ruby_error_closed_stream as ruby_error_stream_closed, like the
  message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-09 02:34:49 +00:00
normal cf6ec79b37 thread.c: comments on M:N threading [ci skip]
I may experiment with M:N threading in coming months.  Often I
find myself yearning for the old 1.8 days when spawning threads
was really cheap for network operations.  But I also like to use
native blocking recv_io and accept calls for round-robin load
distribution and accessing files on systems with dozens of slow
rotational disks.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-02 01:14:14 +00:00
ko1 3651c0aa00 Fiber also has same issue. [Bug #13313]
* thread.c (rb_vm_proc_local_ep): added.

* cont.c (rb_fiber_start): use rb_vm_proc_local_ep().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-14 06:52:44 +00:00
nobu 1943242a46 thread.c: Thread.start with Symbol
* thread.c (thread_do_start): fix segfault at start with Symbol.
  proc created by Symbol#to_proc does not have environment unless
  using refinements.  [ruby-core:80147] [Bug #13313]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-14 05:54:35 +00:00
nobu c3f92cf213 thread.c: thread_do_start
* thread.c (thread_do_start): extract from a macro in
  thread_start_func_2 for debugger.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-14 05:54:33 +00:00
nobu ea7af54e73 thread.c: rb_thread_fd_close [ci skip]
* thread.c (rb_thread_fd_close): remove deprecated. a couple of
  external libraries used it.  [ruby-core:80078] [Bug #13304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13 05:30:44 +00:00
nobu 5b72a06cbe thread.c: rb_thread_fd_close no longer returns
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13 03:30:11 +00:00
nobu c617568c53 thread.c: rb_thread_fd_close [ci skip]
* thread.c (rb_thread_fd_close): re-define only for abi-check,
  abort if called.  [ruby-core:80078] [Bug #13304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13 02:14:15 +00:00
nobu 7d54b4ea58 Thread#fetch
* thread.c (rb_thread_fetch): add new method Thread#fetch.
  [Feature #13009]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-22 07:16:13 +00:00
nobu cd89148199 thread.c: fix for VC
* thread.c (rb_fd_no_init): make void same as rb_fd_init_copy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-15 05:53:01 +00:00
nobu 957e6e4b14 initialize variables
* string.c (rb_str_enumerate_lines): initialize conditionally
  used variable.

* thread.c (rb_fd_no_init): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-14 07:52:30 +00:00
nobu b1c61c6e18 thread.c: use ASSUME only on gcc 5 or later
* thread.c (rb_fd_no_init): on gcc 4, ASSUME macro affects
  something too much.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-13 15:19:12 +00:00
nobu 959aac29e7 suppress warnings
* string.c (rb_str_enumerate_lines): hint to suppress a
  maybe-uninitialized warning by gcc.

* thread.c (rb_fd_no_init): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-13 05:44:15 +00:00
ko1 38bc085f71 check thread deadness correctly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-10 08:15:39 +00:00
ko1 6897b3b985 define rb_thread_sleep_deadly_allow_spurious_wakeup().
* thread.c, thread_sync.c: define new function
  rb_thread_sleep_deadly_allow_spurious_wakeup() and use it instead of
  using sleep_forever() directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31 06:39:01 +00:00
ko1 919a9d9e02 use TRUE/FALSE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31 06:31:06 +00:00
nobu 61701ae167 io.c: close before wait
* io.c (io_close_fptr): notify then close, and wait for other
  threads before free fptr.  [ruby-core:79262] [Bug #13158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-25 14:34:07 +00:00
nobu c54c60da26 thread.c: fix todo
* thread.c (rb_threadptr_pending_interrupt_check_mask): traverse
  the super class chain instead of making ancestors array.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-10 10:57:26 +00:00
nobu bc855ef139 thread.c: fix race between read and close
* thread.c (rb_thread_fd_close): wait until all threads using the
  fd finish the operation, not to free the buffer in use.
  [ruby-core:78845] [Bug #13076]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-27 07:10:11 +00:00
rhe c54ede0560 proc.c: assume rb_iseq_location_t::first_lineno is always a Fixnum
Do not check for the value of rb_iseq_constant_body::line_info_table as
it is no longer related. The checks seem to be the remains from the day
before the dedicated 'first_lineno' field was introduced. Remove them.

Note, rb_iseq_constant_body::line_info_table can be NULL only when the
iseq does not contain any instructions that originate from Ruby code,
for example, an iseq created with 'proc {}' under a non-default compile
options where trace instructions are disabled.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-20 05:26:07 +00:00
shugo 472959f9c2 Add clang volatile fixes from FreeBSD and NetBSD.
Use volatile instead of optnone to avoid optimization which causes
segmentation faults.
Patch by Dimitry Andric.  [ruby-core:78531] [Bug #13014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07 23:27:51 +00:00
nobu 9e3afec027 thread.c: fix doc of abort_on_exception [ci skip]
* thread.c (rb_thread_s_abort_exc, rb_thread_s_abort_exc_set):
  [DOC] the raised exception will be re-raised in the main thread,
  and then follows the ordinary exception sequence, exit status is
  not 0.  [ruby-core:78415] [Bug #12991]

* thread.c (rb_thread_abort_exc_set): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29 12:54:43 +00:00
ktsj 9cbd6ee097 * vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):
add TracePoint#callee_id. [ruby-core:77241] [Feature #12747]

* cont.c, eval.c, gc.c, include/ruby/intern.h, insns.def, thread.c,
  vm.c, vm_backtrace.c, vm_core.h, vm_eval.c, vm_insnhelper.c, vm_trace.c: ditto.

* test/ruby/test_settracefunc.rb: tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 13:15:27 +00:00