Increase max depth for chain guards

This commit is contained in:
Takashi Kokubun 2023-03-01 23:29:32 -08:00
Родитель 487d4aa970
Коммит 42adcd5743
3 изменённых файлов: 9 добавлений и 6 удалений

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

@ -1649,7 +1649,7 @@ module RubyVM::MJIT
# @param jit [RubyVM::MJIT::JITState] # @param jit [RubyVM::MJIT::JITState]
# @param ctx [RubyVM::MJIT::Context] # @param ctx [RubyVM::MJIT::Context]
# @param asm [RubyVM::MJIT::Assembler] # @param asm [RubyVM::MJIT::Assembler]
def jit_chain_guard(opcode, jit, ctx, asm, side_exit, limit: 10) def jit_chain_guard(opcode, jit, ctx, asm, side_exit, limit: 20)
opcode => :je | :jne | :jnz | :jz opcode => :je | :jne | :jnz | :jz
if ctx.chain_depth < limit if ctx.chain_depth < limit
@ -2572,12 +2572,13 @@ module RubyVM::MJIT
end end
asm.comment("Guard #{comptime_symbol.inspect} is on stack") asm.comment("Guard #{comptime_symbol.inspect} is on stack")
mid_changed_exit = counted_exit(side_exit(jit, ctx), :send_optimized_send_mid_changed) class_changed_exit = counted_exit(side_exit(jit, ctx), :send_optimized_send_mid_class_changed)
jit_guard_known_klass(jit, ctx, asm, comptime_symbol.class, ctx.stack_opnd(argc), comptime_symbol, mid_changed_exit) jit_guard_known_klass(jit, ctx, asm, comptime_symbol.class, ctx.stack_opnd(argc), comptime_symbol, class_changed_exit)
asm.mov(C_ARGS[0], ctx.stack_opnd(argc)) asm.mov(C_ARGS[0], ctx.stack_opnd(argc))
asm.call(C.rb_get_symbol_id) asm.call(C.rb_get_symbol_id)
asm.cmp(C_RET, mid) asm.cmp(C_RET, mid)
jit_chain_guard(:jne, jit, ctx, asm, mid_changed_exit) id_changed_exit = counted_exit(side_exit(jit, ctx), :send_optimized_send_mid_id_changed)
jit_chain_guard(:jne, jit, ctx, asm, id_changed_exit)
# rb_callable_method_entry_with_refinements # rb_callable_method_entry_with_refinements
cme = jit_search_method(jit, ctx, asm, mid, argc, flags, send_shift:) cme = jit_search_method(jit, ctx, asm, mid, argc, flags, send_shift:)

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

@ -157,7 +157,8 @@ MJIT_RUNTIME_COUNTERS(
send_optimized_send_no_args, send_optimized_send_no_args,
send_optimized_send_not_sym_or_str, send_optimized_send_not_sym_or_str,
send_optimized_send_mid_changed, send_optimized_send_mid_class_changed,
send_optimized_send_mid_id_changed,
send_optimized_send_null_mid, send_optimized_send_null_mid,
send_optimized_send_send, send_optimized_send_send,

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

@ -1297,7 +1297,8 @@ module RubyVM::MJIT # :nodoc: all
send_optimized_unknown_type: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_unknown_type)")], send_optimized_unknown_type: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_unknown_type)")],
send_optimized_send_no_args: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_no_args)")], send_optimized_send_no_args: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_no_args)")],
send_optimized_send_not_sym_or_str: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_not_sym_or_str)")], send_optimized_send_not_sym_or_str: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_not_sym_or_str)")],
send_optimized_send_mid_changed: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_mid_changed)")], send_optimized_send_mid_class_changed: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_mid_class_changed)")],
send_optimized_send_mid_id_changed: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_mid_id_changed)")],
send_optimized_send_null_mid: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_null_mid)")], send_optimized_send_null_mid: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_null_mid)")],
send_optimized_send_send: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_send)")], send_optimized_send_send: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_optimized_send_send)")],
invokesuper_me_changed: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), invokesuper_me_changed)")], invokesuper_me_changed: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), invokesuper_me_changed)")],