From bf3eb4364ec7a34a8590bd5063aa76c879011f15 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 18 Nov 2017 09:39:41 +0000 Subject: introduce `trace_events' info for iseq. * 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_trace.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'vm_trace.c') diff --git a/vm_trace.c b/vm_trace.c index c522f5e398..405f6dd34e 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -61,23 +61,15 @@ 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) { - 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; + rb_event_flag_t new_iseq_events = vm_events & ISEQ_TRACE_EVENTS; + rb_event_flag_t cur_iseq_events = ruby_vm_event_flags & ISEQ_TRACE_EVENTS; if (new_iseq_events > cur_iseq_events) { /* write all ISeqs iff new events are added */ - rb_iseq_trace_set_all(vm_events); + rb_iseq_trace_set_all(new_iseq_events); } ruby_vm_event_flags = vm_events; -- cgit v1.2.3