* vm.c: introduce `ruby_vm_event_enabled_flags` which represents which
event flags are enabled before.
* vm_trace.c: do not turn off `trace_` prefix instructions because turn on
overhead is a matter if a program repeats turn on and turn off frequently.
* iseq.c (finish_iseq_build): respect `ruby_vm_event_enabled_flags`.
* vm_insnhelper.c (vm_trace): check `ruby_vm_event_flags` and disable
lazy trace-off technique (do not disable traces).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
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
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
Currently the Fiber stack size is small for powerpc64 and it causes
test/ruby/test_backtrace.rb test to break, since it is using a 8kb stack
size.
It breaks on powerpc64 due to the fact that a frame in the stack is
usually 50% bigger on powerpc64 compared to Intel, due to some
considerations:
* The powerpc64 minimum frame is 2x bigger than on Intel
* Powerpc has more registers that might be saved in the frame compared
to Intel.
I ran the same ruby test that is failing on both Intel and Powerpc, and
each Fiber frame is ~50% bigger on powerpc64 for every single lambda
function, thus, we need to increase the stack size on powerpc64 to
accomodate the same tests/applications.
This fixes bug#13757.
Signed-off-by: Breno Leitao <leitao@debian.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c (vm_trace): use EXEC_EVENT_HOOK() instead of
EXEC_EVENT_HOOK_VM_TRACE(). The latter macro assumes
`ruby_vm_event_flags` is constant in `vm_trace()` function,
but it can be changed in hook functions.
* vm_core.h (EXEC_EVENT_HOOK_VM_TRACE): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_iseq_t::aux): add `trace_events` which represents
which events are enabled on this iseq. With this information,
we can skip useless trace-on changes for ISeqs.
* vm_trace.c (RUBY_EVENTS_TRACE_BY_ISEQ): moved to iseq.h and rename it
with ISEQ_TRACE_EVENTS.
* iseq.h: introduce ISEQ_USE_COMPILE_DATA iseq (imemo) flag to represent
COMPILE_DATA is available. In other words, iseq->aux.trace_events is not
available when this flag is set.
* ISEQ_COMPILE_DATA() is changed from a macro.
* ISEQ_COMPILE_DATA_ALLOC() is added.
* ISEQ_COMPILE_DATA_CLEAR() is added.
* iseq.c: use them.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (EXEC_EVENT_HOOK_VM_TRACE): added to pass vm_event_flags
(== ruby_vm_event_flags) as a macro parameter.
* vm_insnhelper.c (vm_trace): use an added macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* iseq.h (iseq_line_info_entry): rename to iseq_insn_info_entry.
* vm_core.h (rb_iseq_constant_body): rename field name line_info_table
to insns_info and also from line_info_size to insns_info_size.
* compile.c (INSN): add struct insn_info to contain per insn information.
* compile.c (add_insn_info): added to add new insn_info entry.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* 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
* 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_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
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
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
vm_insnhelper.h: ditto.
All changes are for reducing changes required to introduce JIT compiler.
Unlike functions that can be inlined by header, those variables should
be shared with JIT-ed code. This will help reducing cost of rebase
against upstream.
[close GH-1720]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60231 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