1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add VM_NO_KEYWORDS

I think this is easier to read than using literal 0 with comments
in every case where it is used.
This commit is contained in:
Jeremy Evans 2019-09-03 11:50:46 -07:00
parent ce04392d8d
commit fd2ef1a9bf
5 changed files with 9 additions and 8 deletions

2
cont.c
View file

@ -1802,7 +1802,7 @@ rb_fiber_start(void)
th->ec->root_svar = Qfalse;
EXEC_EVENT_HOOK(th->ec, RUBY_EVENT_FIBER_SWITCH, th->self, 0, 0, 0, Qnil);
cont->value = rb_vm_invoke_proc(th->ec, proc, argc, argv, 0 /* kw_splat */, VM_BLOCK_HANDLER_NONE);
cont->value = rb_vm_invoke_proc(th->ec, proc, argc, argv, VM_NO_KEYWORDS, VM_BLOCK_HANDLER_NONE);
}
EC_POP_TAG();

4
proc.c
View file

@ -942,7 +942,7 @@ rb_proc_call(VALUE self, VALUE args)
GetProcPtr(self, proc);
vret = rb_vm_invoke_proc(GET_EC(), proc,
check_argc(RARRAY_LEN(args)), RARRAY_CONST_PTR(args),
0 /* kw_splat */, VM_BLOCK_HANDLER_NONE);
VM_NO_KEYWORDS, VM_BLOCK_HANDLER_NONE);
RB_GC_GUARD(self);
RB_GC_GUARD(args);
return vret;
@ -961,7 +961,7 @@ rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE passed_pr
VALUE vret;
rb_proc_t *proc;
GetProcPtr(self, proc);
vret = rb_vm_invoke_proc(ec, proc, argc, argv, 0 /* kw_splat */, proc_to_block_handler(passed_procval));
vret = rb_vm_invoke_proc(ec, proc, argc, argv, VM_NO_KEYWORDS, proc_to_block_handler(passed_procval));
RB_GC_GUARD(self);
return vret;
}

View file

@ -681,7 +681,7 @@ thread_do_start(rb_thread_t *th)
th->value = rb_vm_invoke_proc(th->ec, proc,
(int)args_len, args_ptr,
0 /* kw_splat */, VM_BLOCK_HANDLER_NONE);
VM_NO_KEYWORDS, VM_BLOCK_HANDLER_NONE);
EXEC_EVENT_HOOK(th->ec, RUBY_EVENT_THREAD_END, th->self, 0, 0, 0, Qundef);
}

8
vm.c
View file

@ -1160,7 +1160,7 @@ static VALUE
vm_yield_with_cref(rb_execution_context_t *ec, int argc, const VALUE *argv, const rb_cref_t *cref, int is_lambda)
{
return invoke_block_from_c_bh(ec, check_block_handler(ec),
argc, argv, 0 /* kw_splat */, VM_BLOCK_HANDLER_NONE,
argc, argv, VM_NO_KEYWORDS, VM_BLOCK_HANDLER_NONE,
cref, is_lambda, FALSE);
}
@ -1168,7 +1168,7 @@ static VALUE
vm_yield(rb_execution_context_t *ec, int argc, const VALUE *argv)
{
return invoke_block_from_c_bh(ec, check_block_handler(ec),
argc, argv, 0 /* kw_splat */, VM_BLOCK_HANDLER_NONE,
argc, argv, VM_NO_KEYWORDS, VM_BLOCK_HANDLER_NONE,
NULL, FALSE, FALSE);
}
@ -1176,7 +1176,7 @@ static VALUE
vm_yield_with_block(rb_execution_context_t *ec, int argc, const VALUE *argv, VALUE block_handler)
{
return invoke_block_from_c_bh(ec, check_block_handler(ec),
argc, argv, 0 /* kw_splat */, block_handler,
argc, argv, VM_NO_KEYWORDS, block_handler,
NULL, FALSE, FALSE);
}
@ -1184,7 +1184,7 @@ static VALUE
vm_yield_force_blockarg(rb_execution_context_t *ec, VALUE args)
{
return invoke_block_from_c_bh(ec, check_block_handler(ec), 1, &args,
0 /* kw_splat */, VM_BLOCK_HANDLER_NONE, NULL, FALSE, TRUE);
VM_NO_KEYWORDS, VM_BLOCK_HANDLER_NONE, NULL, FALSE, TRUE);
}
ALWAYS_INLINE(static VALUE

View file

@ -1268,6 +1268,7 @@ VM_FRAME_RUBYFRAME_P(const rb_control_frame_t *cfp)
#define VM_GUARDED_PREV_EP(ep) GC_GUARDED_PTR(ep)
#define VM_BLOCK_HANDLER_NONE 0
#define VM_NO_KEYWORDS 0
static inline int
VM_ENV_LOCAL_P(const VALUE *ep)