summaryrefslogtreecommitdiff
path: root/vm_trace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-14 13:25:11 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-14 13:25:11 +0000
commit19ae98d5ce12cd29d5bd276afbfd0a365265121f (patch)
treec969b61ebf69b3b3e6e34f2a9ef1a874d25fa17b /vm_trace.c
parentb000b1d93041f8466439709da7b71e1f3122d530 (diff)
rewrite only if changed.
* vm_trace.c (update_global_event_hook): rewrite ISeqs only when effective events are changed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_trace.c')
-rw-r--r--vm_trace.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/vm_trace.c b/vm_trace.c
index 3b9f025d89..6587898284 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -59,11 +59,22 @@ rb_vm_trace_mark_event_hooks(rb_hook_list_t *hooks)
/* 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);
}