From eda8dcea164b561359f638b1489d0ab12659c9a2 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Thu, 5 Sep 2019 17:31:00 +0900 Subject: [PATCH] Add a comment that some ci->flag is inconsistent after CALLER_SETUP_ARG --- vm_insnhelper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vm_insnhelper.c b/vm_insnhelper.c index baf99c4d66..55369c7cd9 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1743,12 +1743,22 @@ CALLER_SETUP_ARG(struct rb_control_frame_struct *restrict cfp, const struct rb_call_info *restrict ci, int remove_empty_keyword_hash) { if (UNLIKELY(IS_ARGS_SPLAT(ci))) { + /* This expands the rest argument to the stack. + * So, ci->flag & VM_CALL_ARGS_SPLAT is now inconsistent. + */ vm_caller_setup_arg_splat(cfp, calling); } if (UNLIKELY(IS_ARGS_KEYWORD(ci))) { + /* This converts VM_CALL_KWARG style to VM_CALL_KW_SPLAT style + * by creating a keyword hash. + * So, ci->flag & VM_CALL_KWARG is now inconsistent. + */ vm_caller_setup_arg_kw(cfp, calling, ci); } if (UNLIKELY(calling->kw_splat && remove_empty_keyword_hash)) { + /* This removes the last Hash object if it is empty. + * So, ci->flag & VM_CALL_KW_SPLAT is now inconsistent. + */ if (RHASH_EMPTY_P(cfp->sp[-1])) { cfp->sp--; calling->argc--;