mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Don't cancel JIT-ed code on TracePoint :class
events get enabled
This commit is contained in:
parent
365da4c6ac
commit
ac4d53bd46
3 changed files with 17 additions and 2 deletions
3
NEWS.md
3
NEWS.md
|
@ -173,6 +173,9 @@ Excluding feature bug fixes.
|
|||
|
||||
* The default `--jit-max-cache` is changed from 100 to 10000.
|
||||
|
||||
* JIT-ed code is no longer cancelled when a TracePoint for class events
|
||||
is enabled.
|
||||
|
||||
* The JIT compiler no longer skips compilation of methods longer than
|
||||
1000 instructions.
|
||||
|
||||
|
|
|
@ -1101,6 +1101,14 @@ class TestJIT < Test::Unit::TestCase
|
|||
end;
|
||||
end
|
||||
|
||||
def test_not_cancel_by_tracepoint_class
|
||||
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", success_count: 1, min_calls: 2)
|
||||
begin;
|
||||
TracePoint.new(:class) {}.enable
|
||||
2.times {}
|
||||
end;
|
||||
end
|
||||
|
||||
def test_cancel_by_tracepoint
|
||||
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", success_count: 0, min_calls: 2)
|
||||
begin;
|
||||
|
|
|
@ -81,8 +81,12 @@ update_global_event_hook(rb_event_flag_t vm_events)
|
|||
rb_event_flag_t enabled_iseq_events = ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS;
|
||||
|
||||
if (new_iseq_events & ~enabled_iseq_events) {
|
||||
// Stop calling all JIT-ed code. We can't rewrite existing JIT-ed code to trace_ insns for now.
|
||||
mjit_cancel_all("TracePoint is enabled");
|
||||
// :class events are triggered only in ISEQ_TYPE_CLASS, but mjit_target_iseq_p ignores such iseqs.
|
||||
// Thus we don't need to cancel JIT-ed code for :class events.
|
||||
if (new_iseq_events != RUBY_EVENT_CLASS) {
|
||||
// Stop calling all JIT-ed code. We can't rewrite existing JIT-ed code to trace_ insns for now.
|
||||
mjit_cancel_all("TracePoint is enabled");
|
||||
}
|
||||
|
||||
/* write all ISeqs if and only if new events are added */
|
||||
rb_iseq_trace_set_all(new_iseq_events | enabled_iseq_events);
|
||||
|
|
Loading…
Add table
Reference in a new issue