1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

filter out internal events. add comments. reorder

This commit is contained in:
Alan Wu 2021-08-26 14:58:13 -04:00
parent 4b815abb37
commit 54db64f7a5
2 changed files with 15 additions and 5 deletions

View file

@ -98,11 +98,16 @@ update_global_event_hook(rb_event_flag_t vm_events)
rb_clear_attr_ccs(); rb_clear_attr_ccs();
} }
yjit_tracing_invalidate_all();
ruby_vm_event_flags = vm_events; ruby_vm_event_flags = vm_events;
ruby_vm_event_enabled_global_flags |= vm_events; ruby_vm_event_enabled_global_flags |= vm_events;
rb_objspace_set_event_hook(vm_events); rb_objspace_set_event_hook(vm_events);
if (vm_events & RUBY_EVENT_TRACEPOINT_ALL) {
// Invalidate all code if listening for any TracePoint event.
// Internal events fire inside C routines so don't need special handling.
// Do this last so other ractors see updated vm events when they wake up.
yjit_tracing_invalidate_all();
}
} }
/* add/remove hooks */ /* add/remove hooks */

View file

@ -3842,12 +3842,17 @@ static void invalidate_all_blocks_for_tracing(const rb_iseq_t *iseq);
// they are waiting for a return from a C routine. For every routine call, we // they are waiting for a return from a C routine. For every routine call, we
// patch in an exit after the body of the containing VM instruction. This makes // patch in an exit after the body of the containing VM instruction. This makes
// it so all the invalidated code exit as soon as execution logically reaches // it so all the invalidated code exit as soon as execution logically reaches
// the next VM instruction. // the next VM instruction. The interpreter takes care of firing the tracing
// event if it so happens that the next VM instruction has one attached.
//
// The c_return event needs special handling as our codegen never outputs code // The c_return event needs special handling as our codegen never outputs code
// that contains tracing logic. If we let the normal output code run until the // that contains tracing logic. If we let the normal output code run until the
// start of the next VM instruction by relying on the patching scheme above, we // start of the next VM instruction by relying on the patching scheme above, we
// would fail to fire the c_return event. To handle it, we patch in the full // would fail to fire the c_return event. The interpreter doesn't fire the
// logic at the return address. See full_cfunc_return(). // event at an instruction boundary, so simply exiting to the interpreter isn't
// enough. To handle it, we patch in the full logic at the return address. See
// full_cfunc_return().
//
// In addition to patching, we prevent future entries into invalidated code by // In addition to patching, we prevent future entries into invalidated code by
// removing all live blocks from their iseq. // removing all live blocks from their iseq.
void void