diff options
author | Alan Wu <[email protected]> | 2021-08-25 17:00:45 -0400 |
---|---|---|
committer | Alan Wu <[email protected]> | 2021-10-20 18:19:39 -0400 |
commit | bd876c243aeace00ea312d0a5bbff091ccc84ba2 (patch) | |
tree | e30156ab87c3345a995dcd47c11dc9a535643694 /iseq.c | |
parent | 0562459473f44c270784074a09a33ea30d68e457 (diff) |
TracePoint support
This change fixes some cases where YJIT fails to fire tracing events.
Most of the situations YJIT did not handle correctly involves enabling
tracing while running inside generated code.
A new operation to invalidate all generated code is added, which uses
patching to make generated code exit at the next VM instruction
boundary. A new routine called `jit_prepare_routine_call()` is
introduced to facilitate this and should be used when generating code
that could allocate, or could otherwise use `RB_VM_LOCK_ENTER()`.
The `c_return` event is fired in the middle of an instruction as opposed
to at an instruction boundary, so it requires special handling. C method
call return points are patched to go to a fucntion which does everything
the interpreter does, including firing the `c_return` event. The
generated code for C method calls normally does not fire the event.
Invalided code should not change after patching so the exits are not
clobbered. A new variable is introduced to track the region of code that
should not change.
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 16 |
1 files changed, 0 insertions, 16 deletions
@@ -3181,14 +3181,6 @@ typedef struct insn_data_struct { } insn_data_t; static insn_data_t insn_data[VM_INSTRUCTION_SIZE/2]; - - - -#include "yjit_asm.h" - - - - void rb_vm_encoded_insn_data_table_init(void) { @@ -3305,10 +3297,6 @@ iseq_add_local_tracepoint(const rb_iseq_t *iseq, rb_event_flag_t turnon_events, VM_ASSERT(ISEQ_EXECUTABLE_P(iseq)); -#if USE_MJIT - // Force write the jit function to NULL - *((jit_func_t *)(&body->jit_func)) = 0; -#endif for (pc=0; pc<body->iseq_size;) { const struct iseq_insn_info_entry *entry = get_insn_info(iseq, pc); @@ -3445,10 +3433,6 @@ rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events) rb_event_flag_t pc_events = rb_iseq_event_flags(iseq, pc); pc += encoded_iseq_trace_instrument(&iseq_encoded[pc], pc_events & enabled_events, true); } -#if USE_MJIT - // Force write the jit function to NULL - *((jit_func_t *)(&body->jit_func)) = 0; -#endif } } |