summaryrefslogtreecommitdiff
path: root/vm_trace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-17 06:24:55 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-17 06:24:55 +0000
commit1a960576262223e6ea1a2ead214cfaf90fc304e6 (patch)
tree205f823f742d167a555109901757ef0150004493 /vm_trace.c
parent80facdd93a6ed5519ada32b14703967866aa22f1 (diff)
remove `trace_` prefix insns lazily.
* vm_trace.c (update_global_event_hook): set only when tracing is added. If tracing was off (event flags are decreased), then ignore them. Next `trace_` prefix instruction will trace off itself (lazy tracing off). * vm_insnhelper.c (vm_trace): trace-off for when trace is not needed. * iseq.c (rb_iseq_trace_set): fix trace-off process (it was never off tracing). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_trace.c')
-rw-r--r--vm_trace.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/vm_trace.c b/vm_trace.c
index efa2ee1bfb..d01a966a70 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -72,10 +72,14 @@ rb_vm_trace_mark_event_hooks(rb_hook_list_t *hooks)
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);
+ rb_event_flag_t new_iseq_events = vm_events & RUBY_EVENTS_TRACE_BY_ISEQ;
+ rb_event_flag_t cur_iseq_events = ruby_vm_event_flags & RUBY_EVENTS_TRACE_BY_ISEQ;
+
+ if (new_iseq_events > cur_iseq_events) {
+ /* write all ISeqs iff new events are added */
+ rb_iseq_trace_set_all(vm_events);
}
+
ruby_vm_event_flags = vm_events;
rb_objspace_set_event_hook(vm_events);
}