ruby-changes:57593
From: Yusuke <ko1@a...>
Date: Fri, 6 Sep 2019 12:55:09 +0900 (JST)
Subject: [ruby-changes:57593] acee630241 (master): vm_insnhelper.c: Do not read `ci->flag` after CALLER_SETUP_ARG
https://git.ruby-lang.org/ruby.git/commit/?id=acee630241 From acee6302419f02792ec331d384f430c5fc6bdb70 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Thu, 5 Sep 2019 18:34:07 +0900 Subject: vm_insnhelper.c: Do not read `ci->flag` after CALLER_SETUP_ARG Actually, the following call is wrongly warned without this change. ``` class C def method_missing(x, *args, **opt) end end C.new.foo(k: 1) # warning: The last argument is used as the keyword parameter # warning: for `method_missing' defined here ``` diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 55369c7..8b8fb94 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2206,7 +2206,7 @@ vm_call_cfunc_with_frame(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2206 int argc = calling->argc; int orig_argc = argc; - if (UNLIKELY(IS_ARGS_KW_OR_KW_SPLAT(ci))) { + if (UNLIKELY(calling->kw_splat)) { frame_type |= VM_FRAME_FLAG_CFRAME_KW; } @@ -2417,7 +2417,7 @@ vm_call_method_missing(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2417 CALLER_SETUP_ARG(reg_cfp, calling, orig_ci, 0); argc = calling->argc+1; - ci_entry.flag = VM_CALL_FCALL | VM_CALL_OPT_SEND | (orig_ci->flag & VM_CALL_KW_SPLAT); + ci_entry.flag = VM_CALL_FCALL | VM_CALL_OPT_SEND | (calling->kw_splat ? VM_CALL_KW_SPLAT : 0); ci_entry.mid = idMethodMissing; ci_entry.orig_argc = argc; ci = &ci_entry; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/