1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/tool/ruby_vm/views
ko1 96990203b7 Support targetting TracePoint [Feature #15289]
* vm_trace.c (rb_tracepoint_enable_for_target): support targetting
  TracePoint. [Feature #15289]

  Tragetting TracePoint is only enabled on specified method, proc
  and so on, example: `tp.enable(target: code)`.

  `code` should be consisted of InstructionSeuqnece (iseq)
  (RubyVM::InstructionSeuqnece.of(code) should not return nil)
  If code is a tree of iseq, TracePoint is enabled on all of
  iseqs in a tree.

  Enabled tragetting TracePoints can not enabled again with
  and without target.

* vm_core.h (rb_iseq_t): introduce `rb_iseq_t::local_hooks`
  to store local hooks.
  `rb_iseq_t::aux::trace_events` is renamed to
  `global_trace_events` to contrast with `local_hooks`.

* vm_core.h (rb_hook_list_t): add `rb_hook_list_t::running`
  to represent how many Threads/Fibers are used this list.
  If this field is 0, nobody using this hooks and we can
  delete it.

  This is why we can remove code from cont.c.

* vm_core.h (rb_vm_t): because of above change, we can eliminate
  `rb_vm_t::trace_running` field.
  Also renamed from `rb_vm_t::event_hooks` to `global_hooks`.

* vm_core.h, vm.c (ruby_vm_event_enabled_global_flags): renamed
  from `ruby_vm_event_enabled_flags.

* vm_core.h, vm.c (ruby_vm_event_local_num): added to count
  enabled targetting TracePoints.

* vm_core.h, vm_trace.c (rb_exec_event_hooks): accepts
  hook list.

* vm_core.h (rb_vm_global_hooks): added for convinience.

* method.h (rb_method_bmethod_t): added to maintain Proc
  and `rb_hook_list_t` for bmethod (defined by define_method).

* prelude.rb (TracePoint#enable): extracet a keyword parameter
  (because it is easy than writing in C).
  It calls `TracePoint#__enable` internal method written in C.

* vm_insnhelper.c (vm_trace): check also iseq->local_hooks.

* vm.c (invoke_bmethod): check def->body.bmethod.hooks.

* vm.c (hook_before_rewind): check iseq->local_hooks
  and def->body.bmethod.hooks before rewind by exception.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-26 18:16:39 +00:00
..
_attributes.erb
_c_expr.erb
_copyright.erb
_insn_entry.erb move ADD_PC around (take 2) 2018-09-14 07:44:44 +00:00
_insn_len_info.erb
_insn_name_info.erb tool/ruby_vm/views/_insn_name_info.erb: Auto-detect the longest insn name 2018-05-02 00:57:50 +00:00
_insn_operand_info.erb
_insn_stack_increase.erb
_insn_type_chars.erb
_leaf_helpers.erb Use friendlier terminology in leaf helpers 2018-11-11 01:25:33 +00:00
_mjit_compile_insn.erb Support targetting TracePoint [Feature #15289] 2018-11-26 18:16:39 +00:00
_mjit_compile_insn_body.erb move ADD_PC around (take 2) 2018-09-14 07:44:44 +00:00
_mjit_compile_ivar.erb _mjit_compile_ivar.erb: cancel on undefined ivar 2018-10-24 15:41:14 +00:00
_mjit_compile_pc_and_sp.erb _mjit_compile_pc_and_sp.erb: forget about memcpy [ci skip] 2018-09-12 13:32:11 +00:00
_mjit_compile_send.erb Support targetting TracePoint [Feature #15289] 2018-11-26 18:16:39 +00:00
_notice.erb
_trace_instruction.erb
insns.inc.erb
insns_info.inc.erb add new instruction attribute called leaf 2018-09-11 09:48:58 +00:00
mjit_compile.inc.erb _mjit_compile_ivar.erb: optimize setivar as well 2018-10-14 13:25:21 +00:00
opt_sc.inc.erb
optinsn.inc.erb
optunifs.inc.erb
vm.inc.erb
vmtc.inc.erb