YJIT: record `num_send_cfunc` stat (#9022)

* YJIT: record num_send_cfunc stat

Also report num_send_known_cfunc as percentage of num_send_cfunc

* Rename num_send_known_cfunc => num_send_cfunc_inline

Name seems more descriptive of what we do with out custom codegen
This commit is contained in:
Maxime Chevalier-Boisvert 2023-11-23 15:33:43 -05:00 коммит произвёл GitHub
Родитель 315240e73b
Коммит f05d586cc9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -304,7 +304,8 @@ module RubyVM::YJIT
out.puts "num_send_dynamic: " + format_number_pct(13, stats[:num_send_dynamic], stats[:num_send])
out.puts "num_send_inline: " + format_number_pct(13, stats[:num_send_inline], stats[:num_send])
out.puts "num_send_leaf_builtin: " + format_number_pct(13, stats[:num_send_leaf_builtin], stats[:num_send])
out.puts "num_send_known_cfunc: " + format_number_pct(13, stats[:num_send_known_cfunc], stats[:num_send])
out.puts "num_send_cfunc: " + format_number_pct(13, stats[:num_send_cfunc], stats[:num_send])
out.puts "num_send_cfunc_inline: " + format_number_pct(13, stats[:num_send_cfunc_inline], stats[:num_send_cfunc])
if stats[:num_send_x86_rel32] != 0 || stats[:num_send_x86_reg] != 0
out.puts "num_send_x86_rel32: " + format_number(13, stats[:num_send_x86_rel32])
out.puts "num_send_x86_reg: " + format_number(13, stats[:num_send_x86_reg])

Просмотреть файл

@ -5398,6 +5398,8 @@ fn gen_send_cfunc(
return None;
}
gen_counter_incr(asm, Counter::num_send_cfunc);
// Delegate to codegen for C methods if we have it.
if kw_arg.is_null() && flags & VM_CALL_OPT_SEND == 0 && flags & VM_CALL_ARGS_SPLAT == 0 && (cfunc_argc == -1 || argc == cfunc_argc) {
let codegen_p = lookup_cfunc_codegen(unsafe { (*cme).def });
@ -5405,7 +5407,7 @@ fn gen_send_cfunc(
if let Some(known_cfunc_codegen) = codegen_p {
if known_cfunc_codegen(jit, asm, ocb, ci, cme, block, argc, recv_known_klass) {
assert_eq!(expected_stack_after, asm.ctx.get_stack_size() as i32);
gen_counter_incr(asm, Counter::num_send_known_cfunc);
gen_counter_incr(asm, Counter::num_send_cfunc_inline);
// cfunc codegen generated code. Terminate the block so
// there isn't multiple calls in the same block.
jump_to_next_insn(jit, asm, ocb);
@ -5433,7 +5435,6 @@ fn gen_send_cfunc(
argc - kw_arg_num + 1
};
// If the argument count doesn't match
if cfunc_argc >= 0 && cfunc_argc != passed_argc && flags & VM_CALL_ARGS_SPLAT == 0 {
gen_counter_incr(asm, Counter::send_cfunc_argc_mismatch);

Просмотреть файл

@ -482,7 +482,8 @@ make_counters! {
num_send_dynamic,
num_send_inline,
num_send_leaf_builtin,
num_send_known_cfunc,
num_send_cfunc,
num_send_cfunc_inline,
num_getivar_megamorphic,
num_setivar_megamorphic,