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

ruby-changes:62146

From: Nobuyoshi <ko1@a...>
Date: Mon, 6 Jul 2020 12:50:07 +0900 (JST)
Subject: [ruby-changes:62146] d94ef7c6b6 (master): Run method_missing in the same execution context

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

From d94ef7c6b61c89f2c16c1d13af18310b9cd65d89 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 6 Jul 2020 10:46:57 +0900
Subject: Run method_missing in the same execution context


diff --git a/vm_args.c b/vm_args.c
index fe7b7f0..ac39b31 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -12,7 +12,7 @@ NORETURN(static void raise_argument_error(rb_execution_context_t *ec, const rb_i https://github.com/ruby/ruby/blob/trunk/vm_args.c#L12
 NORETURN(static void argument_arity_error(rb_execution_context_t *ec, const rb_iseq_t *iseq, const int miss_argc, const int min_argc, const int max_argc));
 NORETURN(static void argument_kw_error(rb_execution_context_t *ec, const rb_iseq_t *iseq, const char *error, const VALUE keys));
 VALUE rb_keyword_error_new(const char *error, VALUE keys); /* class.c */
-static VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv,
+static VALUE method_missing(rb_execution_context_t *ec, VALUE obj, ID id, int argc, const VALUE *argv,
                             enum method_missing_reason call_status, int kw_splat);
 #if !defined(_MSC_VER) || !defined(MJIT_HEADER)
 MJIT_FUNC_EXPORTED
@@ -867,7 +867,7 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)) https://github.com/ruby/ruby/blob/trunk/vm_args.c#L867
 	vm_passed_block_handler_set(ec, blockarg);
     }
     if (!me) {
-        return method_missing(obj, mid, argc, argv, MISSING_NOENTRY, kw_splat);
+        return method_missing(ec, obj, mid, argc, argv, MISSING_NOENTRY, kw_splat);
     }
     return rb_vm_call0(ec, obj, mid, argc, argv, me, kw_splat);
 }
diff --git a/vm_eval.c b/vm_eval.c
index db63dcd..e086125 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -15,7 +15,7 @@ struct local_var_list { https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L15
     VALUE tbl;
 };
 
-static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum method_missing_reason call_status, int kw_splat);
+static inline VALUE method_missing(rb_execution_context_t *ec, VALUE obj, ID id, int argc, const VALUE *argv, enum method_missing_reason call_status, int kw_splat);
 static inline VALUE vm_yield_with_cref(rb_execution_context_t *ec, int argc, const VALUE *argv, int kw_splat, const rb_cref_t *cref, int is_lambda);
 static inline VALUE vm_yield(rb_execution_context_t *ec, int argc, const VALUE *argv, int kw_splat);
 static inline VALUE vm_yield_with_block(rb_execution_context_t *ec, int argc, const VALUE *argv, VALUE block_handler, int kw_splat);
@@ -194,7 +194,7 @@ vm_call0_body(rb_execution_context_t *ec, struct rb_calling_info *calling, struc https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L194
             }
 
             enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0;
-            ret = method_missing(calling->recv, vm_ci_mid(ci), calling->argc, argv, ex, calling->kw_splat);
+            ret = method_missing(ec, calling->recv, vm_ci_mid(ci), calling->argc, argv, ex, calling->kw_splat);
             goto success;
 	}
       case VM_METHOD_TYPE_ALIAS:
@@ -203,7 +203,7 @@ vm_call0_body(rb_execution_context_t *ec, struct rb_calling_info *calling, struc https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L203
       case VM_METHOD_TYPE_MISSING:
 	{
 	    vm_passed_block_handler_set(ec, calling->block_handler);
-	    return method_missing(calling->recv, vm_ci_mid(ci), calling->argc,
+	    return method_missing(ec, calling->recv, vm_ci_mid(ci), calling->argc,
                                   argv, MISSING_NOENTRY, calling->kw_splat);
 	}
       case VM_METHOD_TYPE_OPTIMIZED:
@@ -258,7 +258,7 @@ vm_call_super(rb_execution_context_t *ec, int argc, const VALUE *argv, int kw_sp https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L258
     me = rb_callable_method_entry(klass, id);
 
     if (!me) {
-        return method_missing(recv, id, argc, argv, MISSING_SUPER, kw_splat);
+        return method_missing(ec, recv, id, argc, argv, MISSING_SUPER, kw_splat);
     }
     return rb_vm_call_kw(ec, recv, id, argc, argv, me, kw_splat);
 }
@@ -355,7 +355,7 @@ rb_call0(rb_execution_context_t *ec, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L355
     call_status = rb_method_call_status(ec, me, scope, self);
 
     if (call_status != MISSING_NONE) {
-        return method_missing(recv, mid, argc, argv, call_status, kw_splat);
+        return method_missing(ec, recv, mid, argc, argv, call_status, kw_splat);
     }
     stack_check(ec);
     return rb_vm_call_kw(ec, recv, mid, argc, argv, me, kw_splat);
@@ -810,10 +810,9 @@ vm_raise_method_missing(rb_execution_context_t *ec, int argc, const VALUE *argv, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L810
 }
 
 static inline VALUE
-method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum method_missing_reason call_status, int kw_splat)
+method_missing(rb_execution_context_t *ec, VALUE obj, ID id, int argc, const VALUE *argv, enum method_missing_reason call_status, int kw_splat)
 {
     VALUE *nargv, result, work, klass;
-    rb_execution_context_t *ec = GET_EC();
     VALUE block_handler = vm_passed_block_handler(ec);
     const rb_callable_method_entry_t *me;
 
-- 
cgit v0.10.2


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

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