ruby-changes:48649
From: ko1 <ko1@a...>
Date: Tue, 14 Nov 2017 22:25:15 +0900 (JST)
Subject: [ruby-changes:48649] ko1:r60765 (trunk): rewrite only if changed.
ko1 2017-11-14 22:25:11 +0900 (Tue, 14 Nov 2017) New Revision: 60765 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60765 Log: rewrite only if changed. * vm_trace.c (update_global_event_hook): rewrite ISeqs only when effective events are changed. Modified files: trunk/vm_trace.c Index: vm_trace.c =================================================================== --- vm_trace.c (revision 60764) +++ vm_trace.c (revision 60765) @@ -59,11 +59,22 @@ rb_vm_trace_mark_event_hooks(rb_hook_lis https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L59 /* ruby_vm_event_flags management */ +#define RUBY_EVENTS_TRACE_BY_ISEQ (RUBY_EVENT_LINE | \ + RUBY_EVENT_CLASS | \ + RUBY_EVENT_END | \ + RUBY_EVENT_CALL | \ + RUBY_EVENT_RETURN| \ + RUBY_EVENT_B_CALL| \ + RUBY_EVENT_B_RETURN) + static void update_global_event_hook(rb_event_flag_t vm_events) { + if ((vm_events & RUBY_EVENTS_TRACE_BY_ISEQ) != + (ruby_vm_event_flags & RUBY_EVENTS_TRACE_BY_ISEQ)) { + rb_iseq_trace_set_all(vm_events); + } ruby_vm_event_flags = vm_events; - rb_iseq_trace_set_all(vm_events); rb_objspace_set_event_hook(vm_events); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/