* 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
* 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_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_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
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
[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 (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 (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
* 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
* 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
* 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
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 (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_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 (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
* 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
* 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
* 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 (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