YJIT: Fallback megamorphic opt_case_dispatch (#9894)
This commit is contained in:
parent
80490acfb6
commit
717adb564b
5
yjit.rb
5
yjit.rb
@ -323,8 +323,9 @@ module RubyVM::YJIT
|
||||
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])
|
||||
end
|
||||
out.puts "num_getivar_megamorphic: " + format_number(13, stats[:num_getivar_megamorphic])
|
||||
out.puts "num_setivar_megamorphic: " + format_number(13, stats[:num_setivar_megamorphic])
|
||||
out.puts "num_getivar_megamorphic: " + format_number(11, stats[:num_getivar_megamorphic])
|
||||
out.puts "num_setivar_megamorphic: " + format_number(11, stats[:num_setivar_megamorphic])
|
||||
out.puts "num_opt_case_megamorphic: " + format_number(10, stats[:num_opt_case_dispatch_megamorphic])
|
||||
out.puts "num_throw: " + format_number(13, stats[:num_throw])
|
||||
out.puts "num_throw_break: " + format_number_pct(13, stats[:num_throw_break], stats[:num_throw])
|
||||
out.puts "num_throw_retry: " + format_number_pct(13, stats[:num_throw_retry], stats[:num_throw])
|
||||
|
@ -4037,7 +4037,13 @@ fn gen_opt_case_dispatch(
|
||||
all_fixnum
|
||||
}
|
||||
|
||||
if comptime_key.fixnum_p() && comptime_key.0 <= u32::MAX.as_usize() && case_hash_all_fixnum_p(case_hash) {
|
||||
// If megamorphic, fallback to compiling branch instructions after opt_case_dispatch
|
||||
let megamorphic = asm.ctx.get_chain_depth() >= CASE_WHEN_MAX_DEPTH;
|
||||
if megamorphic {
|
||||
gen_counter_incr(asm, Counter::num_opt_case_dispatch_megamorphic);
|
||||
}
|
||||
|
||||
if comptime_key.fixnum_p() && comptime_key.0 <= u32::MAX.as_usize() && case_hash_all_fixnum_p(case_hash) && !megamorphic {
|
||||
if !assume_bop_not_redefined(jit, asm, ocb, INTEGER_REDEFINED_OP_FLAG, BOP_EQQ) {
|
||||
return None;
|
||||
}
|
||||
|
@ -592,6 +592,7 @@ make_counters! {
|
||||
|
||||
num_getivar_megamorphic,
|
||||
num_setivar_megamorphic,
|
||||
num_opt_case_dispatch_megamorphic,
|
||||
|
||||
num_throw,
|
||||
num_throw_break,
|
||||
|
Loading…
x
Reference in New Issue
Block a user