Skip to content

Commit

Permalink
stats break down for fusable branch types
Browse files Browse the repository at this point in the history
  • Loading branch information
XrXr committed Apr 5, 2024
1 parent b6f700d commit 615dd9f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions yjit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ def _print_stats(out: $stderr) # :nodoc:
out.puts "branch_insn_count: " + format_number(13, stats[:branch_insn_count])
out.puts "branch_known_count: " + format_number_pct(13, stats[:branch_known_count], stats[:branch_insn_count])
out.puts "branch_fused_count: " + format_number_pct(13, stats[:branch_fused_count], stats[:branch_insn_count])
out.puts "branch_fuse_lt: " + format_number_pct(13, stats[:branch_fuse_lt], stats[:branch_insn_count])
out.puts "branch_fuse_le: " + format_number_pct(13, stats[:branch_fuse_le], stats[:branch_insn_count])
out.puts "branch_fuse_gt: " + format_number_pct(13, stats[:branch_fuse_gt], stats[:branch_insn_count])
out.puts "branch_fuse_ge: " + format_number_pct(13, stats[:branch_fuse_ge], stats[:branch_insn_count])

out.puts "freed_iseq_count: " + format_number(13, stats[:freed_iseq_count])
out.puts "invalidation_count: " + format_number(13, stats[:invalidation_count])
Expand Down
12 changes: 12 additions & 0 deletions yjit/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3361,6 +3361,18 @@ fn gen_fixnum_cmp(
return None;
}

if jit.next_insn_opcode() == YARVINSN_branchunless {
if bop == BOP_LT {
incr_counter!(branch_fuse_lt);
} else if bop == BOP_GT {
incr_counter!(branch_fuse_gt);
} else if bop == BOP_LE {
incr_counter!(branch_fuse_le);
} else if bop == BOP_GE {
incr_counter!(branch_fuse_ge);
}
}

// Check that both operands are fixnums
guard_two_fixnums(jit, asm, ocb);

Expand Down
4 changes: 4 additions & 0 deletions yjit/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ make_counters! {
branch_insn_count,
branch_known_count,
branch_fused_count,
branch_fuse_lt,
branch_fuse_le,
branch_fuse_gt,
branch_fuse_ge,
max_inline_versions,

freed_iseq_count,
Expand Down

0 comments on commit 615dd9f

Please sign in to comment.