[前][次][番号順一覧][スレッド一覧]

ruby-changes:57576

From: Jeremy <ko1@a...>
Date: Fri, 6 Sep 2019 09:50:59 +0900 (JST)
Subject: [ruby-changes:57576] fd2ef1a9bf (master): Add VM_NO_KEYWORDS

https://git.ruby-lang.org/ruby.git/commit/?id=fd2ef1a9bf

From fd2ef1a9bfa489842472d183ea10b6fd9838c460 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Tue, 3 Sep 2019 11:50:46 -0700
Subject: Add VM_NO_KEYWORDS

I think this is easier to read than using literal 0 with comments
in every case where it is used.

diff --git a/cont.c b/cont.c
index 4b60c78..d48f845 100644
--- a/cont.c
+++ b/cont.c
@@ -1802,7 +1802,7 @@ rb_fiber_start(void) https://github.com/ruby/ruby/blob/trunk/cont.c#L1802
         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 87ae422..db2f62e 100644
--- a/proc.c
+++ b/proc.c
@@ -942,7 +942,7 @@ rb_proc_call(VALUE self, VALUE args) https://github.com/ruby/ruby/blob/trunk/proc.c#L942
     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 https://github.com/ruby/ruby/blob/trunk/proc.c#L961
     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 b5fa991..6958897 100644
--- a/thread.c
+++ b/thread.c
@@ -681,7 +681,7 @@ thread_do_start(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/thread.c#L681
 
         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 59cceca..8ba1ef3 100644
--- a/vm.c
+++ b/vm.c
@@ -1160,7 +1160,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/vm.c#L1160
 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 https://github.com/ruby/ruby/blob/trunk/vm.c#L1168
 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 https://github.com/ruby/ruby/blob/trunk/vm.c#L1176
 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 https://github.com/ruby/ruby/blob/trunk/vm.c#L1184
 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 a679f05..fdd34e4 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1268,6 +1268,7 @@ VM_FRAME_RUBYFRAME_P(const rb_control_frame_t *cfp) https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1268
 
 #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)
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]