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

ruby-changes:48436

From: ko1 <ko1@a...>
Date: Sun, 29 Oct 2017 23:45:21 +0900 (JST)
Subject: [ruby-changes:48436] ko1:r60550 (trunk): `rb_call0()` accepts `ec`.

ko1	2017-10-29 23:45:16 +0900 (Sun, 29 Oct 2017)

  New Revision: 60550

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60550

  Log:
    `rb_call0()` accepts `ec`.
    
    * vm_eval.c (rb_call0): accepts `ec`.

  Modified files:
    trunk/vm_eval.c
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 60549)
+++ vm_eval.c	(revision 60550)
@@ -272,6 +272,7 @@ static inline enum method_missing_reason https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L272
  * calls the specified method.
  *
  * This function is called by functions in rb_call* family.
+ * \param ec     current execution context
  * \param recv   receiver of the method
  * \param mid    an ID that represents the name of the method
  * \param argc   the number of method arguments
@@ -283,11 +284,11 @@ static inline enum method_missing_reason https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L284
  * \note \a self is used in order to controlling access to protected methods.
  */
 static inline VALUE
-rb_call0(VALUE recv, ID mid, int argc, const VALUE *argv,
+rb_call0(rb_execution_context_t *ec,
+	 VALUE recv, ID mid, int argc, const VALUE *argv,
 	 call_type scope, VALUE self)
 {
     const rb_callable_method_entry_t *me = rb_search_method_entry(recv, mid);
-    rb_execution_context_t *ec = GET_EC();
     enum method_missing_reason call_status = rb_method_call_status(ec, me, scope, self);
 
     if (call_status != MISSING_NONE) {
@@ -586,8 +587,8 @@ rb_method_call_status(rb_execution_conte https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L587
 static inline VALUE
 rb_call(VALUE recv, ID mid, int argc, const VALUE *argv, call_type scope)
 {
-    rb_thread_t *th = GET_THREAD();
-    return rb_call0(recv, mid, argc, argv, scope, th->ec->cfp->self);
+    rb_execution_context_t *ec = GET_EC();
+    return rb_call0(ec, recv, mid, argc, argv, scope, ec->cfp->self);
 }
 
 NORETURN(static void raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv,
@@ -864,13 +865,13 @@ send_internal(int argc, const VALUE *arg https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L865
     VALUE vid;
     VALUE self;
     VALUE ret, vargv = 0;
-    rb_thread_t *th = GET_THREAD();
+    rb_execution_context_t *ec = GET_EC();
 
     if (scope == CALL_PUBLIC) {
 	self = Qundef;
     }
     else {
-	self = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->ec->cfp)->self;
+	self = RUBY_VM_PREVIOUS_CONTROL_FRAME(ec->cfp)->self;
     }
 
     if (argc == 0) {
@@ -888,7 +889,7 @@ send_internal(int argc, const VALUE *arg https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L889
 	    rb_exc_raise(exc);
 	}
 	if (!SYMBOL_P(*argv)) {
-	    VALUE *tmp_argv = current_vm_stack_arg(th, argv);
+	    VALUE *tmp_argv = current_vm_stack_arg(rb_ec_thread_ptr(ec), argv);
 	    vid = rb_str_intern(vid);
 	    if (tmp_argv) {
 		tmp_argv[0] = vid;
@@ -904,13 +905,13 @@ send_internal(int argc, const VALUE *arg https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L905
 	    }
 	}
 	id = idMethodMissing;
-	th->method_missing_reason = MISSING_NOENTRY;
+	rb_ec_thread_ptr(ec)->method_missing_reason = MISSING_NOENTRY;
     }
     else {
 	argv++; argc--;
     }
-    PASS_PASSED_BLOCK_HANDLER_EC(th->ec);
-    ret = rb_call0(recv, id, argc, argv, scope, self);
+    PASS_PASSED_BLOCK_HANDLER_EC(ec);
+    ret = rb_call0(ec, recv, id, argc, argv, scope, self);
     ALLOCV_END(vargv);
     return ret;
 }

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

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