Skip to content

Commit 984e05a

Browse files
committed
ZJIT: Count dynamic dispatch (SendWithoutBlock)
1 parent fb3d2a2 commit 984e05a

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

zjit.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def stats_string
5656
:total_insn_count,
5757
:vm_insn_count,
5858
:zjit_insn_count,
59+
:zjit_dynamic_dispatch,
5960
:ratio_in_zjit,
6061
], buf:, stats:)
6162
print_counters_with_prefix(prefix: 'exit_', prompt: 'side exit reasons', buf:, stats:, limit: 20)

zjit/src/codegen.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,10 @@ fn gen_send_without_block(
858858
cd: *const rb_call_data,
859859
state: &FrameState,
860860
) -> lir::Opnd {
861+
if get_option!(stats) {
862+
gen_incr_counter(asm, Counter::zjit_dynamic_dispatch);
863+
}
864+
861865
// Note that it's incorrect to use this frame state to side exit because
862866
// the state might not be on the boundary of an interpreter instruction.
863867
// For example, `opt_str_uminus` pushes to the stack and then sends.

zjit/src/stats.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ make_counters! {
7272
// The number of times YARV instructions are executed on JIT code
7373
zjit_insn_count,
7474

75+
// The number of times we do a dynamic dispatch from JIT code
76+
zjit_dynamic_dispatch,
77+
7578
// failed_: Compilation failure reasons
7679
failed_iseq_stack_too_large,
7780
failed_hir_compile,

0 commit comments

Comments
 (0)