aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
Commit message (Collapse)AuthorAgeFilesLines
* th->ec: dtraceko12017-11-071-7/+7
| | | | | | | | * 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
* `rb_execution_context_t *` should not be `th`ko12017-11-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* th->ec: vm_once_dispatch.ko12017-11-071-3/+4
| | | | | | | * vm_insnhelper.c (vm_once_dispatch): accepts `ec`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval_intern.h: rename macros rb_thread_raised_* toko12017-11-071-2/+2
| | | | | | | rb_ec_raised_*. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move `rb_thread_t::method_missing_reason` to ec.ko12017-11-071-2/+2
| | | | | | | | * vm_core.h (rb_thread_t): move method_missing_reason to rb_execution_context_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move rb_thread_t::interrupt_flag and maskko12017-11-061-2/+2
| | | | | | | | | | | | | | | | 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
* constify `rb_vm_bh_to_procval()`ko12017-10-291-1/+1
| | | | | | | | | * vm_insnhelper.c (rb_vm_bh_to_procval): constify 1st param (ec). * vm_args.c (args_setup_block_parameter): accepts (const) `ec`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `th` -> `ec` for rb_raise_method_missing().ko12017-10-291-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* EXEC_EVENT_HOOK(ec, ...)ko12017-10-291-2/+2
| | | | | | | * 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 backtrace functions.ko12017-10-281-1/+1
| | | | | | | | | | | | | * 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
* move fields from `th` to `ec`.ko12017-10-281-4/+3
| | | | | | | | | | * 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
* `th` -> `ec` for `rb_insn_func_t`.ko12017-10-271-2/+2
| | | | | | | | | | | * vm_core.h (rb_insn_func_t): accepts `ec` instead of `th`. * vm_insnhelper.c (rb_vm_opt_struct_aref): ditto. * vm_insnhelper.c (rb_vm_opt_struct_aset): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `th` -> `ec` for block related functions.ko12017-10-271-28/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* `ec` -> `th`ko12017-10-271-4/+4
| | | | | | | | | * vm_exec.h (VM_SP_CNT): accepts `ec` instead of `th`. * vm_insnhelper.c (vm_stack_consistency_error): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_defined() accepts `ec` instead of `th`.ko12017-10-271-3/+3
| | | | | | | * vm_insnhelper.c (vm_defined): accepts `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove duplicated definition.ko12017-10-271-25/+2
| | | | | | | | * vm_insnhelper.c (vm_block_handler_to_proc): removed because it is same functionality of rb_vm_bh_to_procval(). Use rb_vm_bh_to_procval(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_search_super_method() accepts `ec` instead of `th`.ko12017-10-271-1/+1
| | | | | | | | | * vm_insnhelper.c (vm_search_super_method): accepts `ec` instead of `th`. Surprisingly, it doesn't use `th` (now `ec`) so this patch is for the future extension. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_get_ev_const() accepts `ec` instead of `th`.ko12017-10-271-5/+5
| | | | | | | * vm_insnhelper.c (vm_get_ev_const): accepts `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `vm_call_handler` and related functions accept `ec` instead of `th`.ko12017-10-271-100/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm_core.h (vm_call_handler): fix to accept `ec` instead of `th`. * vm_args.c: the following functions accept `ec` instead of `th`. * raise_argument_error * argument_arity_error * argument_kw_error * setup_parameters_complex * vm_eval.c: ditto. * vm_call0 * vm_call0_cfunc_with_frame * vm_call0_cfunc * vm_call0_body * vm_insnhelper.c: ditto * vm_call_iseq_setup_tailcall_0start * vm_call_iseq_setup_normal_0start * vm_callee_setup_arg * vm_call_iseq_setup * vm_call_iseq_setup_2 * vm_call_iseq_setup_normal * vm_call_iseq_setup_tailcall * vm_cfp_consistent_p * vm_call_cfunc_with_frame * vm_call_cfunc * vm_call_ivar * vm_call_attrset * vm_call_bmethod_body * vm_call_bmethod * vm_call_opt_send * vm_call_opt_call * vm_call_method_missing * vm_call_zsuper * current_method_entry * vm_call_method_each_type * vm_call_method_nome * vm_call_method * vm_call_general * vm_call_super_method * tool/mk_call_iseq_optimized.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_throw* accept `ec` instead of `th`.ko12017-10-271-13/+13
| | | | | | | * vm_insnhelper.c (vm_throw*): accept `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ec->th for vm_cref_push() and constify.ko12017-10-271-7/+7
| | | | | | | | | | | | | | | * vm_insnhelper.c (vm_cref_push): accepts `ec` instead of `th`. * vm_insnhelper.c: consitfy the first parameter (ec): * lep_svar * lep_svar_write * lep_svar_get * lep_svar_set * vm_getspecial and added vm_cref_push. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Some functions accept `ec` instead of `th`.ko12017-10-271-15/+15
| | | | | | | | | | | | * 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
* refactoring (rb_|)threadptr_stack_overflow.ko12017-10-271-15/+15
| | | | | | | | | * vm_insnhelper.c (ec_stack_overflow): renamed from threadptr_stack_overflow and also rb_ec_stack_overflow is from rb_threadptr_stack_overflow because they accept `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_get_ruby_level_caller_cfp() accepts `ec` instead of `th`.ko12017-10-271-2/+2
| | | | | | | | | * 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
* rb_vm_bh_to_procval() accepts `ec` instead of `th`.ko12017-10-261-2/+2
| | | | | | | * vm_insnhelper.c (rb_vm_bh_to_procval): accepts `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* replace `GET_THREAD()->ec` to `GET_EC()`.ko12017-10-261-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* introduce EC_*_TAG() instead of TH_*_TAG()ko12017-10-261-2/+2
| | | | | | | | | | | | | | | | * 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-7/+7
| | | | | | | * 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-31/+16
| | | | | | | * 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
* A function accepts `ec` instead of `th`.ko12017-10-261-2/+2
| | | | | | | * 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-7/+7
| | | | | | | | | | | | | | | | | | | | | * 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-33/+33
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Lazy Proc allocation for block parametersko12017-10-241-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Feature #14045] * insns.def (getblockparam, setblockparam): add special access instructions for block parameters. getblockparam checks VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM and if it is not set this instruction creates a Proc object from a given blcok and set VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM. setblockparam is similar to setlocal, but set VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM. * compile.c: use get/setblockparm instead get/setlocal instructions. Note that they are used for method local block parameters (def m(&b)), not for block local method parameters (iter{|&b|). * proc.c (get_local_variable_ptr): creates Proc object for Binding#local_variable_get/set. * safe.c (safe_setter): we need to create Proc objects for postponed block parameters when $SAFE is changed. * vm_args.c (args_setup_block_parameter): used only for block local blcok parameters. * vm_args.c (vm_caller_setup_arg_block): if called with VM_CALL_ARGS_BLOCKARG_BLOCKPARAM flag then passed block values should be a block handler. * test/ruby/test_optimization.rb: add tests. * benchmark/bm_vm1_blockparam*: added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: array aref optimizationnobu2017-10-221-3/+2
| | | | | | | * vm_insnhelper.c (vm_opt_aref): optimize on other than fixnum argument too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: super_method of included methodnobu2017-10-061-3/+4
| | | | | | | | | | * proc.c (method_super_method): search the next super method along the included ancestor chain. [ruby-core:83114] [Bug #13973] * vm_method.c (rb_callable_method_entry_without_refinements): return the defined class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* intern instructionnobu2017-09-181-7/+0
| | | | | | | * insns.def (intern): new instruction to turn string into symbol. opt_call_c_function can not dump. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* literal symbol by internnobu2017-09-171-0/+7
| | | | | | | | | | * compile.c (iseq_compile_each0): literal symbol should not be affected by redefinition of String#intern method. * vm_insnhelper.c (rb_vm_str_intern): intern a string into a symbol directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* store ec instead of thread in rb_context_t.ko12017-09-101-14/+29
| | | | | | | | | | | | | | | | * 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
* vm_insnhelper.c: fix opt_regexpmatch2 instructionrhe2017-09-031-2/+2
| | | | | | | A fix-up for r58390 ("split insns.def into functions", 2017-04-18) which accidentally swapped the arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: fatal stacknobu2017-08-221-3/+3
| | | | | | | * signal.c (check_stack_overflow): raise fatal when the last tag is in danger zone. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: ruby_error_stackfatalnobu2017-08-211-1/+1
| | | | | | | | | | * vm_core.h (ruby_special_exceptions): rename sysstack_gc as stackfatal. * eval.c (Init_eval): modified the message for stackfatal error as "critical region". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: vm_cfp_consistent_pnobu2017-08-181-3/+13
| | | | | | | * vm_insnhelper.c (vm_cfp_consistent_p): extracted the conditions for cfp consistency. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: raise ruby_error_sysstack_gcnobu2017-08-181-1/+3
| | | | | | | * vm_insnhelper.c (rb_threadptr_stack_overflow): rb_fatal is not available during GC. raise the preallocated fatal error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: cfp error at stack overflownobu2017-08-161-1/+3
| | | | | | | | * 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
* rename rb_execution_context_t::stack(_size) to vm_stack(_size).ko12017-08-101-2/+2
| | | | | | | | | * 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
* splat keyword hashnobu2017-08-051-1/+1
| | | | | | | | | | * compile.c (compile_array_keyword_arg): set keyword splat flag if explicitly splatted. [ruby-core:68124] [Bug #10856] * vm_args.c (setup_parameters_complex): try keyword hash splat if given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* visibility of inherited methodnobu2017-07-291-2/+3
| | | | | | | | | | * vm_insnhelper.c (vm_call_method_each_type): honor the original visibility of inherited methods when a refinement is defined but not activated. [ruby-core:82209] [Bug #13776] Author: Mon_Ouie (Mon ouïe) <mon.ouie@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adjust indent [ci skip]nobu2017-07-291-38/+38
| | | | | | | * vm_insnhelper.c (vm_call_method_each_type): adjust indent of a block in switch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: dump iseqnobu2017-06-301-0/+7
| | | | | | | | | * vm_insnhelper.c (vm_stack_consistency_error): raise a fatal error with the disassembled instruction sequence, in the development version, instead of very rarely useful rb_bug in such case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move fields to ec.ko12017-06-281-1/+1
| | | | | | | | | | * 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