summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-17 06:24:55 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-17 06:24:55 (GMT)
commit1a960576262223e6ea1a2ead214cfaf90fc304e6 (patch)
tree205f823f742d167a555109901757ef0150004493 /vm_insnhelper.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_insnhelper.c')
-rw-r--r--vm_insnhelper.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 357a85d..b172c2d 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -3729,9 +3729,16 @@ vm_trace(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, const VALUE *p
{
const rb_iseq_t *iseq = reg_cfp->iseq;
size_t pos = pc - iseq->body->iseq_encoded;
+ rb_event_flag_t cur_event_flags = ruby_vm_event_flags;
rb_event_flag_t events = rb_iseq_event_flags(iseq, pos);
rb_event_flag_t event;
+ if ((events & cur_event_flags) == 0) {
+ /* disable trace */
+ rb_iseq_trace_set(iseq, cur_event_flags);
+ return;
+ }
+
if (ec->trace_arg != NULL) return;
if (0) {