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

727 Коммитов

Автор SHA1 Сообщение Дата
k0kubun 857827e3ee vm.c: partially revert r60558
because it was actually used in
https://github.com/tmm1/rbtrace/blob/v0.4.8/ext/rbtrace.c#L329
and deprecated in r60579 AFTER removal in r60558.

ko1 agreed that we should keep just deprecated in Ruby 2.5 and remove it
later, and I'm commiting this because I want to make rbtrace.gem
installation successful.

backward.h: modify r60579 to make rb_frame_method_id_and_class()
compilable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-01 12:26:40 +00:00
mame ec3a906bb6 Refactoring out the direct accesses of NODE's u1, u2, and u3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 11:03:37 +00:00
ko1 d4a69bb48e make a func static.
* vm.c (rb_proc_create_from_captured): make this func static and renmae
  with vm_ prefix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:43:27 +00:00
ko1 686e54f705 make it static.
* vm.c (rb_thread_mark): now file local.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:28:16 +00:00
ko1 003fd99ab3 provide rb_vm_make_proc/lambda().
* vm.c (rb_vm_make_proc): removed.

* vm_core.h: provide utility inline functions
  * rb_vm_make_proc()
  * rb_vm_make_lambda()
  to call rb_vm_make_proc_lambda().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:25:30 +00:00
ko1 360b78e4dc `rb_source_loc` -> `rb_source_location_cstr`
* vm.c (rb_source_loc): rename to rb_source_location_cstr()
  to make behavior clear compare with rb_source_location().

* error.c (warning_string): use rb_source_location_cstr() directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:52:19 +00:00
ko1 15abb96177 fix r60789.
* vm.c (rb_source_loc): fix condition.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:45:44 +00:00
ko1 7a666c6766 rb_source_location() may return nil.
* vm.c (rb_source_location): return nil if path is not found.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:35:58 +00:00
ko1 b3cab0dc74 remove an unused function.
* vm.c (rb_sourcefilename): removed because nobody use it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:18:29 +00:00
ko1 ea665dcd8c add `ec` as first parameter.
* vm.c (vm_svar_get): accepts `ec` as first parameter.

* vm.c (vm_svar_set): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:14:18 +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
ko1 0c2746a7bb th->ec: dtrace
* vm.c (ruby_th_dtrace_setup): rename to rb_dtrace_setup()
  and accept `ec`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 08:19:25 +00:00
ko1 48ce4cb414 * eval_intern.h: rename macros rb_thread_raised_* to
rb_ec_raised_*.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 05:22:09 +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 c7c173a618 remove unused functions.
* vm.c (rb_frame_method_id_and_class): removed because nobody use it.

* vm.c (rb_thread_current_status): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 15:17:29 +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 7fa4beba91 `th` -> `ec` for method management functions.
* vm_eval.c: `th` -> `ec` for the following functions:
  * check_funcall_respond_to
  * check_funcall_callable
  * check_funcall_missing
  * rb_method_call_status

* vm_method.c: ditto.
  * call_method_entry
  * basic_obj_respond_to_missing
  * basic_obj_respond_to
  * vm_respond_to

* vm_eval.c (stack_check): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 12:23:51 +00:00
ko1 4cd402ae1f `th` -> `ec` for rb_vm_make_binding().
* vm.c (rb_vm_make_binding): accepts (const) `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 11:15:56 +00:00
ko1 2317b5da2a rename a function.
* vm.c (rb_thread_method_id_and_class): rename to
  rb_ec_frame_method_id_and_class() and accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 11:11:17 +00:00
ko1 6d803d4391 * vm.c (vm_define_method): don't use `th` any more.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 11:04:08 +00:00
ko1 c12897cbea * vm.c (REWIND_CFP): use `ec` directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 11:02:16 +00:00
ko1 874d6b329e `th` -> `ec` for vm_iter_break().
* vm.c (vm_iter_break): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 10:59:37 +00:00
ko1 e6956c048a `th` -> `ec` for some functions.
* vm.c: `th` -> `ec` for the following functions:
  * vm_normal_frame
  * vm_cfp_svar_get
  * vm_cfp_svar_set


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 10:55:35 +00:00
ko1 5a7bd5349c `th` -> `ec` for some functions.
* vm.c (rb_vm_get_binding_creatable_next_cfp): accepts `ec` instead of `th`.

* vm.c (rb_vm_stack_to_heap): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 10:47:19 +00:00
ko1 9ca5088428 `th` -> `ec` for rb_vm_rewind_cfp.
* vm.c (rb_vm_rewind_cfp): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 10:43:30 +00:00
ko1 796e1990be `th` -> `ec` for vm_exec().
* vm.c (vm_exec): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 10:35:55 +00:00
ko1 9c4542dbaa `th` -> `ec` for vm_set_*_stack.
* vm.c: `th` -> `ec` for the following functions:
  * vm_set_top_stack
  * vm_set_eval_stack
  * vm_set_main_stack
  * vm_cref_new_toplevel


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 10:23:58 +00:00
ko1 f8a9d044f4 move fields from `th` to `ec`.
* vm_core.h: move rb_thread_t::passed_block_handler to
  rb_execution_context_t::passed_block_handler.
  Also move rb_thread_t::passed_bmethod_me to
  rb_execution_context_t::passed_bmethod_me.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 10:01:54 +00:00
ko1 4563273909 skip machine stack marking for current ec.
* vm.c (rb_execution_context_mark): At the beggining of GC marking,
  mark_current_machine_context() marks running machine stack so that
  rb_execution_context_mark() should not mark machine stack if it is
  current ec.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 05:36:48 +00:00
ko1 04dc3a0ca6 vm_exec_core() accepts `ec` instead of `th`.
* vm_exec.c (vm_exec_core): accepts `ec` instead of `th`.

* vm_args.c (vm_caller_setup_arg_block): also accepts `ec`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27 06:21:50 +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 34ff953e37 Some functions accept `ec` instead of `th`.
* vm_insnhelper.c: The following functions accept `ec` instead of `th`.
  * lep_svar
  * lep_svar_write
  * lep_svar_get
  * lep_svar_set
  * vm_getspecial


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27 01:22:01 +00:00
ko1 e47a687c83 vm_get_ruby_level_caller_cfp() accepts `ec` instead of `th`.
* vm.c (vm_get_ruby_level_caller_cfp): accepts `ec` instead of `th`.

* vm.c (vm_collect_local_variables_in_heap): don't need `th` anymore.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27 00:46:11 +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 8afee516be fix freeing `th->ec` bugs.
* vm.c (thread_free): simply call rb_threadptr_root_fiber_release().

* cont.c (rb_threadptr_root_fiber_release): release th->ec (ec->fiber)
  iff root_fiber is NULL. If root_fiber is available, then ignore it
  and root fiber object will free th->ec too.

* cont.c (rb_threadptr_root_fiber_setup): do not set th->root_fiber.
  th->root_fiber will be set if a root fiber object is created.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 14:21:31 +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 284d4c08d6 vm_pop_frame() accepts `ec` instead of `th`.
* vm_insnhelper.c (vm_pop_frame): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 10:55:24 +00:00
ko1 9adf6064ce vm_push_frame() accepts `ec` instead of `th`.
* vm_insnhelper.c (vm_push_frame): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 10:53:42 +00:00
ko1 f3400dfd81 use GET_EC()
* vm.c (vm_ep_in_heap_p_): use GET_EC() instead of GET_THREAD().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 10:52:05 +00:00
ko1 32c41f0c7c A function accepts `ec` instead of `th`.
* vm.c (VM_CFP_IN_HEAP_P): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 10:50:45 +00:00
ko1 a8735ed206 A function accepts `ec` instead of `th`.
* vm.c (rb_vm_search_cf_from_ep): accept `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 10:49:33 +00:00
ko1 e95de48f1d some functions accept `ec` instead of `th`.
* vm.c (vm_make_env_object): accepts `ec`.

* vm.c (rb_vm_get_ruby_level_next_cfp): ditto.

* vm.c (rb_vm_make_proc): ditto.

* vm.c (rb_vm_make_proc_lambda): ditto.

* vm_core.h: some macros accept ec instead of th
  (and make them inline functions):
  * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW
  * RUBY_VM_END_CONTROL_FRAME
  * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P

* eval.c (frame_func_id): constify for the first parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 08:41:34 +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
mame ac3bad418c Remove dynamic NODE allocation out of parser
A temporary NODE object was allocated to create iseq.  Instead, this
patch allocates a dummy NODE as auto variable, and discard it soon.
This change is intended as a preparation to manage AST NODEs out of GC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-24 06:16:31 +00:00
k0kubun b6d97cc9a8 vm.c, vm_insnhelper.h: export symbols of VM serials
This change is for future JIT compiler introduction.
See r60231 for the purpose.

[close GH-1721]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 06:57:04 +00:00
nobu 6a169a499b vm.c: unused function
* vm.c (rb_vm_jump_tag_but_local_jump): no longer used since
  r51292.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-25 21:52:00 +00:00
nobu d352d0a0a7 vm.c: fetch retval iff necessary
* vm.c (rb_vm_make_jump_tag_but_local_jump): get rid of fetching
  retval when it is not used.  it is necessary for local jump
  state only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-25 21:51:56 +00:00
ktsj 698f2db224 vm.c: fix `cfp consistency error' which occurs
when raising exception in bmethod call event

* vm.c (invoke_bmethod): set FINISH flag just before calling vm_exec.
  [ruby-dev:50162] [Bug #13705]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-18 08:21:08 +00:00
ko1 b53b37758d store ec instead of thread in rb_context_t.
* cont.c (rb_context_t): introduce saved_ec instaad of saved_thread.
  We only need to transfer ec data (not all of thread data).

  Introduce `thread_value` field to point creation thread.
  To acccess this field, `cont_thread_value()` is introduced.

* vm.c (rb_execution_context_mark): remove `static` and use it
  from cont.c (use this function instead of `rb_thread_mark`).

* vm_insnhelper.c (rb_vm_push_frame): accept ec instead of th.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-10 19:00:08 +00:00