From de66b60f33106892e714198de6e7432c25a602dd Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Mon, 27 Feb 2023 16:38:40 -0500 Subject: [PATCH] YJIT: add defer_empty_count stat Count how often we defer from a block that is empty --- yjit.rb | 1 + yjit/src/core.rs | 5 +++++ yjit/src/stats.rs | 1 + 3 files changed, 7 insertions(+) diff --git a/yjit.rb b/yjit.rb index d5dde56a36..4ba16c6b26 100644 --- a/yjit.rb +++ b/yjit.rb @@ -269,6 +269,7 @@ module RubyVM::YJIT $stderr.puts "compiled_branch_count: " + format_number(13, stats[:compiled_branch_count]) $stderr.puts "block_next_count: " + format_number(13, stats[:block_next_count]) $stderr.puts "defer_count: " + format_number(13, stats[:defer_count]) + $stderr.puts "defer_empty_count: " + format_number(13, stats[:defer_empty_count]) $stderr.puts "freed_iseq_count: " + format_number(13, stats[:freed_iseq_count]) $stderr.puts "invalidation_count: " + format_number(13, stats[:invalidation_count]) $stderr.puts "constant_state_bumps: " + format_number(13, stats[:constant_state_bumps]) diff --git a/yjit/src/core.rs b/yjit/src/core.rs index df884515d6..e296afc4da 100644 --- a/yjit/src/core.rs +++ b/yjit/src/core.rs @@ -2244,6 +2244,11 @@ pub fn defer_compilation( } asm.mark_branch_end(&branch_rc); + // If the block we're deferring from is empty + if jit.get_block().borrow().get_blockid().idx == jit.get_insn_idx() { + incr_counter!(defer_empty_count); + } + incr_counter!(defer_count); } diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs index 583e82527d..05e970702c 100644 --- a/yjit/src/stats.rs +++ b/yjit/src/stats.rs @@ -310,6 +310,7 @@ make_counters! { compilation_failure, block_next_count, defer_count, + defer_empty_count, freed_iseq_count, exit_from_branch_stub,