Fix comment for VM_CALL_ARGS_SIMPLE (#11067)

* Set VM_CALL_KWARG flag first and reuse it to avoid checking kw_arg twice

* Fix comment for VM_CALL_ARGS_SIMPLE

* Make VM_CALL_ARGS_SIMPLE set-site match its comment
This commit is contained in:
Gabriel Lacroix 2024-06-28 10:11:35 -04:00 committed by GitHub
parent 5c826ebea5
commit 1652c194c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -1439,16 +1439,16 @@ new_callinfo(rb_iseq_t *iseq, ID mid, int argc, unsigned int flag, struct rb_cal
{
VM_ASSERT(argc >= 0);
if (!(flag & (VM_CALL_ARGS_SPLAT | VM_CALL_ARGS_BLOCKARG | VM_CALL_KW_SPLAT | VM_CALL_FORWARDING)) &&
kw_arg == NULL && !has_blockiseq) {
flag |= VM_CALL_ARGS_SIMPLE;
}
if (kw_arg) {
flag |= VM_CALL_KWARG;
argc += kw_arg->keyword_len;
}
if (!(flag & (VM_CALL_ARGS_SPLAT | VM_CALL_ARGS_BLOCKARG | VM_CALL_KWARG | VM_CALL_KW_SPLAT | VM_CALL_FORWARDING))
&& !has_blockiseq) {
flag |= VM_CALL_ARGS_SIMPLE;
}
ISEQ_BODY(iseq)->ci_size++;
const struct rb_callinfo *ci = vm_ci_new(mid, flag, argc, kw_arg);
RB_OBJ_WRITTEN(iseq, Qundef, ci);

View File

@ -17,7 +17,7 @@ enum vm_call_flag_bits {
VM_CALL_ARGS_BLOCKARG_bit, // m(&block)
VM_CALL_FCALL_bit, // m(args) # receiver is self
VM_CALL_VCALL_bit, // m # method call that looks like a local variable
VM_CALL_ARGS_SIMPLE_bit, // (ci->flag & (SPLAT|BLOCKARG)) && blockiseq == NULL && ci->kw_arg == NULL
VM_CALL_ARGS_SIMPLE_bit, // !(ci->flag & (SPLAT|BLOCKARG|KWARG|KW_SPLAT|FORWARDING)) && !has_block_iseq
VM_CALL_KWARG_bit, // has kwarg
VM_CALL_KW_SPLAT_bit, // m(**opts)
VM_CALL_TAILCALL_bit, // located at tail position