From fd2ef1a9bfa489842472d183ea10b6fd9838c460 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Tue, 3 Sep 2019 11:50:46 -0700 Subject: [PATCH] Add VM_NO_KEYWORDS I think this is easier to read than using literal 0 with comments in every case where it is used. --- cont.c | 2 +- proc.c | 4 ++-- thread.c | 2 +- vm.c | 8 ++++---- vm_core.h | 1 + 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cont.c b/cont.c index 4b60c7803d..d48f845369 100644 --- a/cont.c +++ b/cont.c @@ -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(); diff --git a/proc.c b/proc.c index 87ae422d5f..db2f62e090 100644 --- a/proc.c +++ b/proc.c @@ -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; } diff --git a/thread.c b/thread.c index b5fa991a2d..6958897fc1 100644 --- a/thread.c +++ b/thread.c @@ -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); } diff --git a/vm.c b/vm.c index 59cceca685..8ba1ef3952 100644 --- a/vm.c +++ b/vm.c @@ -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 diff --git a/vm_core.h b/vm_core.h index a679f0593f..fdd34e4fae 100644 --- a/vm_core.h +++ b/vm_core.h @@ -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)