summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-02-14 23:48:25 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2023-03-05 23:28:59 -0800
commite078a4a9649240bbac2119891e4bd6c0a4952551 (patch)
treef3eaf525f3a1fd6ff1451bc9e092e221348961ca
parent4271927d619469faa7f82e8899b8c185961137f3 (diff)
Count opt_getconstant_path exit reasons
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7448
-rw-r--r--lib/ruby_vm/mjit/insn_compiler.rb2
-rw-r--r--lib/ruby_vm/mjit/stats.rb1
-rw-r--r--mjit_c.h3
-rw-r--r--mjit_c.rb2
4 files changed, 8 insertions, 0 deletions
diff --git a/lib/ruby_vm/mjit/insn_compiler.rb b/lib/ruby_vm/mjit/insn_compiler.rb
index 04f1a349c7..e723e3f376 100644
--- a/lib/ruby_vm/mjit/insn_compiler.rb
+++ b/lib/ruby_vm/mjit/insn_compiler.rb
@@ -222,6 +222,7 @@ module RubyVM::MJIT
if ice.nil?
# In this case, leave a block that unconditionally side exits
# for the interpreter to invalidate.
+ asm.incr_counter(:optgetconst_not_cached)
return CantCompile
end
@@ -231,6 +232,7 @@ module RubyVM::MJIT
if ice.ic_cref # with cref
# Not supported yet
+ asm.incr_counter(:optgetconst_cref)
return CantCompile
else # without cref
# TODO: implement this
diff --git a/lib/ruby_vm/mjit/stats.rb b/lib/ruby_vm/mjit/stats.rb
index 2ab6af4afe..932043337c 100644
--- a/lib/ruby_vm/mjit/stats.rb
+++ b/lib/ruby_vm/mjit/stats.rb
@@ -37,6 +37,7 @@ module RubyVM::MJIT
print_counters(stats, prefix: 'send_', prompt: 'method call exit reasons')
print_counters(stats, prefix: 'getivar_', prompt: 'getinstancevariable exit reasons')
print_counters(stats, prefix: 'optaref_', prompt: 'opt_aref exit reasons')
+ print_counters(stats, prefix: 'optgetconst_', prompt: 'opt_getconstant_path exit reasons')
$stderr.puts "compiled_block_count: #{format_number(13, stats[:compiled_block_count])}"
$stderr.puts "side_exit_count: #{format_number(13, stats[:side_exit_count])}"
diff --git a/mjit_c.h b/mjit_c.h
index c07b7bc6ec..0103b479c1 100644
--- a/mjit_c.h
+++ b/mjit_c.h
@@ -157,6 +157,9 @@ MJIT_RUNTIME_COUNTERS(
optaref_recv_not_hash,
optaref_send,
+ optgetconst_not_cached,
+ optgetconst_cref,
+
compiled_block_count
)
#undef MJIT_RUNTIME_COUNTERS
diff --git a/mjit_c.rb b/mjit_c.rb
index a5c4878779..f9dad7b608 100644
--- a/mjit_c.rb
+++ b/mjit_c.rb
@@ -1078,6 +1078,8 @@ module RubyVM::MJIT # :nodoc: all
optaref_recv_not_array: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), optaref_recv_not_array)")],
optaref_recv_not_hash: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), optaref_recv_not_hash)")],
optaref_send: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), optaref_send)")],
+ optgetconst_not_cached: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), optgetconst_not_cached)")],
+ optgetconst_cref: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), optgetconst_cref)")],
compiled_block_count: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), compiled_block_count)")],
)
end