Skip to content

Commit

Permalink
Count opt_getconstant_path exit reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Mar 6, 2023
1 parent 4271927 commit e078a4a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ruby_vm/mjit/insn_compiler.rb
Expand Up @@ -222,6 +222,7 @@ def opt_getconstant_path(jit, ctx, asm)
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

Expand All @@ -231,6 +232,7 @@ def opt_getconstant_path(jit, ctx, asm)

if ice.ic_cref # with cref
# Not supported yet
asm.incr_counter(:optgetconst_cref)
return CantCompile
else # without cref
# TODO: implement this
Expand Down
1 change: 1 addition & 0 deletions lib/ruby_vm/mjit/stats.rb
Expand Up @@ -37,6 +37,7 @@ def print_stats
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])}"
Expand Down
3 changes: 3 additions & 0 deletions mjit_c.h
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions mjit_c.rb
Expand Up @@ -1078,6 +1078,8 @@ def C.rb_mjit_runtime_counters
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
Expand Down

0 comments on commit e078a4a

Please sign in to comment.