diff options
author | Takashi Kokubun <[email protected]> | 2023-07-20 10:14:25 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-07-20 13:14:25 -0400 |
commit | b41fc9b9a4ad2043a9fabce15814eade9b252569 (patch) | |
tree | 26413c23ab919cf6fced99886cc75507ac96d594 | |
parent | abce8583e253e96cf1268926ee7fd790f980ea96 (diff) |
YJIT: Avoid undercounting retired_in_yjit (#8038)
* YJIT: Count the number of failed instructions
* Rename yjit_insns_count to exec_instructions instead
* Hoist out the exec_instruction counter
Notes
Notes:
Merged-By: maximecb <[email protected]>
-rw-r--r-- | doc/yjit/yjit.md | 1 | ||||
-rw-r--r-- | yjit.rb | 2 | ||||
-rw-r--r-- | yjit/src/codegen.rs | 10 |
3 files changed, 6 insertions, 7 deletions
diff --git a/doc/yjit/yjit.md b/doc/yjit/yjit.md index 850e8586cd..0ed0bdd055 100644 --- a/doc/yjit/yjit.md +++ b/doc/yjit/yjit.md @@ -226,7 +226,6 @@ irb(main):001:0> RubyVM::YJIT.runtime_stats Some of the counters include: :exec_instruction - how many Ruby bytecode instructions have been executed -:yjit_insns_count - how many Ruby bytecode instruction have been executed in compiled code :binding_allocations - number of bindings allocated :binding_set - number of variables set via a binding :code_gc_count - number of garbage collections of compiled code since process start @@ -317,7 +317,7 @@ module RubyVM::YJIT out.puts "total_exit_count: " + format_number(13, stats[:total_exit_count]) out.puts "total_insns_count: " + format_number(13, stats[:total_insns_count]) out.puts "vm_insns_count: " + format_number(13, stats[:vm_insns_count]) - out.puts "yjit_insns_count: " + format_number(13, stats[:exec_instruction]) + out.puts "exec_instruction: " + format_number(13, stats[:exec_instruction]) out.puts "ratio_in_yjit: " + ("%12.1f" % stats[:ratio_in_yjit]) + "%" out.puts "avg_len_in_yjit: " + ("%13.1f" % stats[:avg_len_in_yjit]) diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index ec84edc4c2..ea421ee725 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -847,14 +847,14 @@ pub fn gen_single_block( verify_ctx(&jit, &asm.ctx); } + // :count-placement: + // Count bytecode instructions that execute in generated code. + // Note that the increment happens even when the output takes side exit. + gen_counter_incr(&mut asm, Counter::exec_instruction); + // Lookup the codegen function for this instruction let mut status = None; if let Some(gen_fn) = get_gen_fn(VALUE(opcode)) { - // :count-placement: - // Count bytecode instructions that execute in generated code. - // Note that the increment happens even when the output takes side exit. - gen_counter_incr(&mut asm, Counter::exec_instruction); - // Add a comment for the name of the YARV instruction asm.comment(&format!("Insn: {:04} {} (stack_size: {})", insn_idx, insn_name(opcode), asm.ctx.get_stack_size())); |