aboutsummaryrefslogtreecommitdiffstats
path: root/vm.c
Commit message (Collapse)AuthorAgeFilesLines
* th->ec: dtraceko12017-11-071-9/+9
| | | | | | | | * 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
* * eval_intern.h: rename macros rb_thread_raised_* toko12017-11-071-1/+1
| | | | | | | rb_ec_raised_*. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* renmae ec::fiber to ec::fiber_ptr.ko12017-11-061-1/+1
| | | | | | | | * 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
* remove unused functions.ko12017-10-291-30/+0
| | | | | | | | | * 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
* EXEC_EVENT_HOOK(ec, ...)ko12017-10-291-22/+22
| | | | | | | * 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
* `th` -> `ec` for method management functions.ko12017-10-281-2/+1
| | | | | | | | | | | | | | | | | | | * 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
* `th` -> `ec` for rb_vm_make_binding().ko12017-10-281-5/+5
| | | | | | | * 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
* rename a function.ko12017-10-281-4/+4
| | | | | | | | * 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
* * vm.c (vm_define_method): don't use `th` any more.ko12017-10-281-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (REWIND_CFP): use `ec` directly.ko12017-10-281-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `th` -> `ec` for vm_iter_break().ko12017-10-281-9/+9
| | | | | | | * 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
* `th` -> `ec` for some functions.ko12017-10-281-12/+12
| | | | | | | | | | * 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
* `th` -> `ec` for some functions.ko12017-10-281-8/+8
| | | | | | | | | * 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
* `th` -> `ec` for rb_vm_rewind_cfp.ko12017-10-281-5/+5
| | | | | | | * 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
* `th` -> `ec` for vm_exec().ko12017-10-281-43/+43
| | | | | | | * 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
* `th` -> `ec` for vm_set_*_stack.ko12017-10-281-25/+26
| | | | | | | | | | | * 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
* move fields from `th` to `ec`.ko12017-10-281-5/+5
| | | | | | | | | | * 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
* skip machine stack marking for current ec.ko12017-10-281-1/+3
| | | | | | | | | | * 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
* vm_exec_core() accepts `ec` instead of `th`.ko12017-10-271-1/+1
| | | | | | | | | * 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
* `th` -> `ec` for block related functions.ko12017-10-271-53/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Some functions accept `ec` instead of `th`.ko12017-10-271-2/+2
| | | | | | | | | | | | * 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
* vm_get_ruby_level_caller_cfp() accepts `ec` instead of `th`.ko12017-10-271-3/+3
| | | | | | | | | * 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
* replace `GET_THREAD()->ec` to `GET_EC()`.ko12017-10-261-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix freeing `th->ec` bugs.ko12017-10-261-9/+4
| | | | | | | | | | | | | | * 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
* introduce EC_*_TAG() instead of TH_*_TAG()ko12017-10-261-8/+9
| | | | | | | | | | | | | | | | * 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
* vm_pop_frame() accepts `ec` instead of `th`.ko12017-10-261-8/+8
| | | | | | | * 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
* vm_push_frame() accepts `ec` instead of `th`.ko12017-10-261-7/+7
| | | | | | | * 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
* use GET_EC()ko12017-10-261-3/+3
| | | | | | | * 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
* A function accepts `ec` instead of `th`.ko12017-10-261-5/+5
| | | | | | | * 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
* A function accepts `ec` instead of `th`.ko12017-10-261-3/+3
| | | | | | | * 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
* some functions accept `ec` instead of `th`.ko12017-10-261-42/+42
| | | | | | | | | | | | | | | | | | | | | * 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
* Use rb_execution_context_t instead of rb_thread_tko12017-10-261-125/+129
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* common conversion functionsnobu2017-10-261-2/+1
| | | | | | | | | | | | | * 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
* Remove dynamic NODE allocation out of parsermame2017-10-241-2/+3
| | | | | | | | 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
* vm.c, vm_insnhelper.h: export symbols of VM serialsk0kubun2017-10-211-4/+3
| | | | | | | | | 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
* vm.c: unused functionnobu2017-09-251-0/+2
| | | | | | | * 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
* vm.c: fetch retval iff necessarynobu2017-09-251-13/+13
| | | | | | | | * 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
* vm.c: fix `cfp consistency error' which occursktsj2017-09-181-1/+2
| | | | | | | | | 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
* store ec instead of thread in rb_context_t.ko12017-09-101-1/+1
| | | | | | | | | | | | | | | | * 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
* move th->machine to ec->machine.ko12017-09-101-8/+9
| | | | | | | | | | | | | | | | | | | | | * 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
* move th->fiber to ec->fiber.ko12017-09-081-1/+1
| | | | | | | | * vm_core.h (rb_thread_t::fiber): move fiber field to rb_execution_context_t::fiber. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* accept ec instead of th.ko12017-09-061-10/+10
| | | | | | | | | | | | * vm.c: VM_EP_IN_HEAP_P() and vm_ep_in_heap_p_() only requires ec pointed from th. * vm.c (rb_execution_context_mark): GET_THREAD() returns current running thread and we need to use marking thread here. Pass marking thread's ec instead of current thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* th is not definedko12017-09-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rb_execution_context_mark.ko12017-09-061-19/+22
| | | | | | | * vm.c (rb_execution_context_mark): separate from thread_mark(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add rb_hash_new_with_size()shyouhei2017-09-051-1/+1
| | | | | | | | | | | | Sometimes, size of a hash can be calcluated a priori. By providing such info to the constructor we can avoid unnecessary internal re- allocations. This can boost for instance creation of hash literals. [Bug #13861] Signed-off-by: Urabe, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* prevent stack overflownobu2017-08-211-0/+1
| | | | | | | | | | * gc.c: enable PREVENT_STACK_OVERFLOW. * vm.c (invoke_iseq_block_from_c): prevent stack overflow. * vm_eval.c (stack_check): raise preallocated exception instance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: cfp error at stack overflownobu2017-08-161-0/+1
| | | | | | | | * vm_insnhelper.c (threadptr_stack_overflow): set stack overflow flag until handling execptions, to get rid of cfp consistency error when exec tag was rewound. [ruby-core:80618] [Bug #13412] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Partially revert "suppress warning: assigned but unused variable - line"naruse2017-08-151-6/+2
| | | | | | revert unexpected changes git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* suppress warning: assigned but unused variable - linenaruse2017-08-151-2/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename rb_execution_context_t::stack(_size) to vm_stack(_size).ko12017-08-101-16/+16
| | | | | | | | | * 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