summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-23 04:12:14 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-23 04:12:14 (GMT)
commitb85b10c11f9846908a319e72c92e779e46c2217f (patch)
treef3ad93ed725d32547b318360d1064a8e2f4b84a7 /iseq.c
parent870af862452adb5418eea8cb830fa06a9fe8270f (diff)
check trace flags at loading [Bug #14702]
* iseq.c (iseq_init_trace): at ISeq loading time, we need to check `ruby_vm_event_enabled_flags` to turn on trace instructions. Seprate this checking code from `finish_iseq_build()` and make new function. `iseq_ibf_load()` calls this funcation after loading. * test/ruby/test_iseq.rb: add a test for this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/iseq.c b/iseq.c
index 04b55bb..cbd2160 100644
--- a/iseq.c
+++ b/iseq.c
@@ -504,6 +504,15 @@ rb_iseq_insns_info_decode_positions(const struct rb_iseq_constant_body *body)
}
#endif
+void
+iseq_init_trace(rb_iseq_t *iseq)
+{
+ iseq->aux.trace_events = 0;
+ if (ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS) {
+ rb_iseq_trace_set(iseq, ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS);
+ }
+}
+
static VALUE
finish_iseq_build(rb_iseq_t *iseq)
{
@@ -531,10 +540,7 @@ finish_iseq_build(rb_iseq_t *iseq)
rb_exc_raise(err);
}
- iseq->aux.trace_events = 0;
- if (ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS) {
- rb_iseq_trace_set(iseq, ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS);
- }
+ iseq_init_trace(iseq);
return Qtrue;
}