summaryrefslogtreecommitdiff
path: root/yjit_iface.h
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-08-25 17:00:45 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:39 -0400
commitbd876c243aeace00ea312d0a5bbff091ccc84ba2 (patch)
treee30156ab87c3345a995dcd47c11dc9a535643694 /yjit_iface.h
parent0562459473f44c270784074a09a33ea30d68e457 (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 'yjit_iface.h')
-rw-r--r--yjit_iface.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/yjit_iface.h b/yjit_iface.h
index c253153321..7aa8206f1e 100644
--- a/yjit_iface.h
+++ b/yjit_iface.h
@@ -54,6 +54,7 @@ YJIT_DECLARE_COUNTERS(
send_cfunc_ruby_array_varg,
send_cfunc_argc_mismatch,
send_cfunc_toomany_args,
+ send_cfunc_tracing,
send_iseq_tailcall,
send_iseq_arity_error,
send_iseq_only_keywords,
@@ -63,6 +64,8 @@ YJIT_DECLARE_COUNTERS(
send_se_cf_overflow,
send_se_protected_check_failed,
+ traced_cfunc_return,
+
leave_se_interrupt,
leave_interp_return,
leave_start_pc_non_zero,
@@ -105,6 +108,7 @@ RUBY_EXTERN struct rb_yjit_runtime_counters yjit_runtime_counters;
void yjit_map_addr2insn(void *code_ptr, int insn);
VALUE *yjit_iseq_pc_at_idx(const rb_iseq_t *iseq, uint32_t insn_idx);
int yjit_opcode_at_pc(const rb_iseq_t *iseq, const VALUE *pc);
+void yjit_print_iseq(const rb_iseq_t *iseq);
void check_cfunc_dispatch(VALUE receiver, struct rb_callinfo *ci, void *callee, rb_callable_method_entry_t *compile_time_cme);