From 6acfc50bccf0c201f77c274281ac33920a0a6923 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 9 Aug 2023 06:54:24 -0700 Subject: [PATCH] YJIT: Count all opt_getconstant_path exit reasons (#8187) --- yjit.rb | 2 +- yjit/src/codegen.rs | 4 +++- yjit/src/stats.rs | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/yjit.rb b/yjit.rb index c512021bb4..db7e33cbf2 100644 --- a/yjit.rb +++ b/yjit.rb @@ -262,7 +262,7 @@ module RubyVM::YJIT print_counters(stats, out: out, prefix: 'opt_aref_', prompt: 'opt_aref exit reasons: ') print_counters(stats, out: out, prefix: 'opt_aref_with_', prompt: 'opt_aref_with exit reasons: ') print_counters(stats, out: out, prefix: 'expandarray_', prompt: 'expandarray exit reasons: ') - print_counters(stats, out: out, prefix: 'opt_getinlinecache_', prompt: 'opt_getinlinecache exit reasons: ') + print_counters(stats, out: out, prefix: 'opt_getconstant_path_', prompt: 'opt_getconstant_path exit reasons: ') print_counters(stats, out: out, prefix: 'invalidate_', prompt: 'invalidation reasons: ') # Number of failed compiler invocations diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 3c82bf3137..374fdddf3d 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -7864,6 +7864,7 @@ fn gen_opt_getconstant_path( if ice.is_null() { // In this case, leave a block that unconditionally side exits // for the interpreter to invalidate. + gen_counter_incr(asm, Counter::opt_getconstant_path_no_ic_entry); return None; } @@ -7884,7 +7885,7 @@ fn gen_opt_getconstant_path( // Check the result. SysV only specifies one byte for _Bool return values, // so it's important we only check one bit to ignore the higher bits in the register. asm.test(ret_val, 1.into()); - asm.jz(Target::side_exit(Counter::opt_getinlinecache_miss)); + asm.jz(Target::side_exit(Counter::opt_getconstant_path_ic_miss)); let inline_cache = asm.load(Opnd::const_ptr(ic as *const u8)); @@ -7906,6 +7907,7 @@ fn gen_opt_getconstant_path( } else { // Optimize for single ractor mode. if !assume_single_ractor_mode(jit, asm, ocb) { + gen_counter_incr(asm, Counter::opt_getconstant_path_multi_ractor); return None; } diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs index 0cd4ff2f44..620a038e32 100644 --- a/yjit/src/stats.rs +++ b/yjit/src/stats.rs @@ -353,7 +353,9 @@ make_counters! { opt_case_dispatch_megamorphic, - opt_getinlinecache_miss, + opt_getconstant_path_ic_miss, + opt_getconstant_path_no_ic_entry, + opt_getconstant_path_multi_ractor, expandarray_splat, expandarray_postarg,