From bf2617b8a679b5ef7eabfa3feb2ef2686d1291f0 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 1 Apr 2023 21:47:28 -0700 Subject: RJIT: Fix has_rest exit conditions --- lib/ruby_vm/rjit/insn_compiler.rb | 14 +++++++------- rjit_c.h | 2 +- rjit_c.rb | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/ruby_vm/rjit/insn_compiler.rb b/lib/ruby_vm/rjit/insn_compiler.rb index ab38000f18..f7a088fe74 100644 --- a/lib/ruby_vm/rjit/insn_compiler.rb +++ b/lib/ruby_vm/rjit/insn_compiler.rb @@ -4130,8 +4130,8 @@ module RubyVM::RJIT return CantCompile end - if iseq_has_rest && iseq.body.param.flags.has_kw - asm.incr_counter(:send_iseq_has_rest_and_kw) + if iseq_has_rest && iseq.body.param.flags.has_kw && supplying_kws + asm.incr_counter(:send_iseq_has_rest_and_kw_supplied) return CantCompile end @@ -4286,6 +4286,11 @@ module RubyVM::RJIT jit_call_opt_send_shift_stack(ctx, asm, argc, send_shift:) end + if iseq_has_rest + asm.incr_counter(:send_iseq_has_rest) + return CantCompile + end + if doing_kw_call asm.incr_counter(:send_iseq_kw_call) return CantCompile @@ -4301,11 +4306,6 @@ module RubyVM::RJIT return CantCompile end - if iseq_has_rest - asm.incr_counter(:send_iseq_has_rest) - return CantCompile - end - # Setup the new frame frame_type ||= C::VM_FRAME_MAGIC_METHOD | C::VM_ENV_FLAG_LOCAL jit_push_frame( diff --git a/rjit_c.h b/rjit_c.h index b227c07966..b80131d14e 100644 --- a/rjit_c.h +++ b/rjit_c.h @@ -60,7 +60,7 @@ RJIT_RUNTIME_COUNTERS( send_iseq_has_kwrest, send_iseq_ruby2_keywords, send_iseq_has_rest_and_captured, - send_iseq_has_rest_and_kw, + send_iseq_has_rest_and_kw_supplied, send_iseq_has_no_kw, send_iseq_zsuper, send_iseq_materialized_block, diff --git a/rjit_c.rb b/rjit_c.rb index 9297a4d431..2016b1764c 100644 --- a/rjit_c.rb +++ b/rjit_c.rb @@ -1334,7 +1334,7 @@ module RubyVM::RJIT # :nodoc: all send_iseq_has_kwrest: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_has_kwrest)")], send_iseq_ruby2_keywords: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_ruby2_keywords)")], send_iseq_has_rest_and_captured: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_has_rest_and_captured)")], - send_iseq_has_rest_and_kw: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_has_rest_and_kw)")], + send_iseq_has_rest_and_kw_supplied: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_has_rest_and_kw_supplied)")], send_iseq_has_no_kw: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_has_no_kw)")], send_iseq_zsuper: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_zsuper)")], send_iseq_materialized_block: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_materialized_block)")], -- cgit v1.2.1