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

ruby-changes:48362

From: ko1 <ko1@a...>
Date: Fri, 27 Oct 2017 15:06:37 +0900 (JST)
Subject: [ruby-changes:48362] ko1:r60476 (trunk): `th` -> `ec` for block related functions.

ko1	2017-10-27 15:06:31 +0900 (Fri, 27 Oct 2017)

  New Revision: 60476

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

  Log:
    `th` -> `ec` for block related functions.
    
    * vm.c: the following functions accept `ec` instead of `th`.
      * invoke_block
      * invoke_bmethod
      * invoke_iseq_block_from_c
      * invoke_block_from_c_bh
      * check_block_handler
      * vm_yield_with_cref
      * vm_yield
      * vm_yield_with_block
      * vm_yield_force_blockarg
      * invoke_block_from_c_proc
      * vm_invoke_proc
      * vm_invoke_bmethod
      * rb_vm_invoke_proc
    
    * vm_insnhelper.c: ditto.
      * vm_yield_with_cfunc
      * vm_yield_with_symbol
      * vm_callee_setup_block_arg
      * vm_yield_setup_args
      * vm_invoke_iseq_block
      * vm_invoke_symbol_block
      * vm_invoke_ifunc_block
      * vm_invoke_block

  Modified files:
    trunk/cont.c
    trunk/insns.def
    trunk/proc.c
    trunk/thread.c
    trunk/vm.c
    trunk/vm_core.h
    trunk/vm_eval.c
    trunk/vm_insnhelper.c
Index: insns.def
===================================================================
--- insns.def	(revision 60475)
+++ insns.def	(revision 60476)
@@ -969,7 +969,7 @@ invokeblock https://github.com/ruby/ruby/blob/trunk/insns.def#L969
     calling.block_handler = VM_BLOCK_HANDLER_NONE;
     calling.recv = GET_SELF();
 
-    val = vm_invoke_block(th, GET_CFP(), &calling, ci);
+    val = vm_invoke_block(th->ec, GET_CFP(), &calling, ci);
     if (val == Qundef) {
 	RESTORE_REGS();
 	NEXT_INSN();
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 60475)
+++ vm_core.h	(revision 60476)
@@ -1499,7 +1499,7 @@ void rb_iseq_pathobj_set(const rb_iseq_t https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1499
 
 int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, ID *called_idp, VALUE *klassp);
 
-VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, int argc, const VALUE *argv, VALUE block_handler);
+VALUE rb_vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, int argc, const VALUE *argv, VALUE block_handler);
 VALUE rb_vm_make_proc_lambda(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda);
 VALUE rb_vm_make_proc(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass);
 VALUE rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp);
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 60475)
+++ vm_eval.c	(revision 60476)
@@ -16,10 +16,10 @@ struct local_var_list { https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L16
 };
 
 static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum method_missing_reason call_status);
-static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref, int is_lambda);
-static inline VALUE vm_yield(rb_thread_t *th, int argc, const VALUE *argv);
-static inline VALUE vm_yield_with_block(rb_thread_t *th, int argc, const VALUE *argv, VALUE block_handler);
-static inline VALUE vm_yield_force_blockarg(rb_thread_t *th, VALUE args);
+static inline VALUE vm_yield_with_cref(rb_execution_context_t *ec, int argc, const VALUE *argv, const rb_cref_t *cref, int is_lambda);
+static inline VALUE vm_yield(rb_execution_context_t *ec, int argc, const VALUE *argv);
+static inline VALUE vm_yield_with_block(rb_execution_context_t *ec, int argc, const VALUE *argv, VALUE block_handler);
+static inline VALUE vm_yield_force_blockarg(rb_execution_context_t *ec, VALUE args);
 static VALUE vm_exec(rb_thread_t *th);
 static void vm_set_eval_stack(rb_thread_t * th, const rb_iseq_t *iseq, const rb_cref_t *cref, const struct rb_block *base_block);
 static int vm_collect_local_variables_in_heap(const VALUE *dfp, const struct local_var_list *vars);
@@ -183,7 +183,7 @@ vm_call0_body(rb_execution_context_t *ec https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L183
 	    {
 		rb_proc_t *proc;
 		GetProcPtr(calling->recv, proc);
-		ret = rb_vm_invoke_proc(rb_ec_thread_ptr(ec), proc, calling->argc, argv, calling->block_handler);
+		ret = rb_vm_invoke_proc(ec, proc, calling->argc, argv, calling->block_handler);
 		goto success;
 	    }
 	  default:
@@ -966,7 +966,7 @@ rb_f_public_send(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L966
 static inline VALUE
 rb_yield_0(int argc, const VALUE * argv)
 {
-    return vm_yield(GET_THREAD(), argc, argv);
+    return vm_yield(GET_EC(), argc, argv);
 }
 
 VALUE
@@ -1031,13 +1031,13 @@ rb_yield_splat(VALUE values) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1031
 VALUE
 rb_yield_force_blockarg(VALUE values)
 {
-    return vm_yield_force_blockarg(GET_THREAD(), values);
+    return vm_yield_force_blockarg(GET_EC(), values);
 }
 
 VALUE
 rb_yield_block(VALUE val, VALUE arg, int argc, const VALUE *argv, VALUE blockarg)
 {
-    return vm_yield_with_block(GET_THREAD(), argc, argv,
+    return vm_yield_with_block(GET_EC(), argc, argv,
 			       NIL_P(blockarg) ? VM_BLOCK_HANDLER_NONE : blockarg);
 }
 
@@ -1544,8 +1544,8 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int le https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1544
 static VALUE
 yield_under(VALUE under, VALUE self, int argc, const VALUE *argv)
 {
-    rb_thread_t *th = GET_THREAD();
-    rb_control_frame_t *cfp = th->ec->cfp;
+    rb_execution_context_t *ec = GET_EC();
+    rb_control_frame_t *cfp = ec->cfp;
     VALUE block_handler = VM_CF_BLOCK_HANDLER(cfp);
     VALUE new_block_handler = 0;
     const struct rb_captured_block *captured = NULL;
@@ -1579,18 +1579,18 @@ yield_under(VALUE under, VALUE self, int https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1579
 	new_captured.self = self;
 	ep = captured->ep;
 
-	VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
+	VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
     }
 
-    cref = vm_cref_push(th->ec, under, ep, TRUE);
-    return vm_yield_with_cref(th, argc, argv, cref, is_lambda);
+    cref = vm_cref_push(ec, under, ep, TRUE);
+    return vm_yield_with_cref(ec, argc, argv, cref, is_lambda);
 }
 
 VALUE
 rb_yield_refine_block(VALUE refinement, VALUE refinements)
 {
-    rb_thread_t *th = GET_THREAD();
-    VALUE block_handler = VM_CF_BLOCK_HANDLER(th->ec->cfp);
+    rb_execution_context_t *ec = GET_EC();
+    VALUE block_handler = VM_CF_BLOCK_HANDLER(ec->cfp);
 
     if (vm_block_handler_type(block_handler) != block_handler_type_iseq) {
 	rb_bug("rb_yield_refine_block: an iseq block is required");
@@ -1600,11 +1600,11 @@ rb_yield_refine_block(VALUE refinement, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1600
 	struct rb_captured_block new_captured = *captured;
 	VALUE new_block_handler = VM_BH_FROM_ISEQ_BLOCK(&new_captured);
 	const VALUE *ep = captured->ep;
-	rb_cref_t *cref = vm_cref_push(th->ec, refinement, ep, TRUE);
+	rb_cref_t *cref = vm_cref_push(ec, refinement, ep, TRUE);
 	CREF_REFINEMENTS_SET(cref, refinements);
-	VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
+	VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
 	new_captured.self = refinement;
-	return vm_yield_with_cref(th, 0, NULL, cref, FALSE);
+	return vm_yield_with_cref(ec, 0, NULL, cref, FALSE);
     }
 }
 
Index: proc.c
===================================================================
--- proc.c	(revision 60475)
+++ proc.c	(revision 60476)
@@ -884,7 +884,7 @@ rb_proc_call(VALUE self, VALUE args) https://github.com/ruby/ruby/blob/trunk/proc.c#L884
     VALUE vret;
     rb_proc_t *proc;
     GetProcPtr(self, proc);
-    vret = rb_vm_invoke_proc(GET_THREAD(), proc,
+    vret = rb_vm_invoke_proc(GET_EC(), proc,
 			     check_argc(RARRAY_LEN(args)), RARRAY_CONST_PTR(args),
 			     VM_BLOCK_HANDLER_NONE);
     RB_GC_GUARD(self);
@@ -901,11 +901,11 @@ proc_to_block_handler(VALUE procval) https://github.com/ruby/ruby/blob/trunk/proc.c#L901
 VALUE
 rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE passed_procval)
 {
-    rb_thread_t *th = GET_THREAD();
+    rb_execution_context_t *ec = GET_EC();
     VALUE vret;
     rb_proc_t *proc;
     GetProcPtr(self, proc);
-    vret = rb_vm_invoke_proc(th, proc, argc, argv, proc_to_block_handler(passed_procval));
+    vret = rb_vm_invoke_proc(ec, proc, argc, argv, proc_to_block_handler(passed_procval));
     RB_GC_GUARD(self);
     return vret;
 }
Index: thread.c
===================================================================
--- thread.c	(revision 60475)
+++ thread.c	(revision 60476)
@@ -585,7 +585,7 @@ thread_do_start(rb_thread_t *th, VALUE a https://github.com/ruby/ruby/blob/trunk/thread.c#L585
 	th->ec->root_lep = rb_vm_proc_local_ep(th->first_proc);
 	th->ec->root_svar = Qfalse;
 	EXEC_EVENT_HOOK(th, RUBY_EVENT_THREAD_BEGIN, th->self, 0, 0, 0, Qundef);
-	th->value = rb_vm_invoke_proc(th, proc,
+	th->value = rb_vm_invoke_proc(th->ec, proc,
 				      (int)RARRAY_LEN(args), RARRAY_CONST_PTR(args),
 				      VM_BLOCK_HANDLER_NONE);
 	EXEC_EVENT_HOOK(th, RUBY_EVENT_THREAD_END, th->self, 0, 0, 0, Qundef);
Index: cont.c
===================================================================
--- cont.c	(revision 60475)
+++ cont.c	(revision 60476)
@@ -1422,7 +1422,7 @@ rb_fiber_start(void) https://github.com/ruby/ruby/blob/trunk/cont.c#L1422
 	th->ec->root_svar = Qfalse;
 
 	EXEC_EVENT_HOOK(th, RUBY_EVENT_FIBER_SWITCH, th->self, 0, 0, 0, Qnil);
-	cont->value = rb_vm_invoke_proc(th, proc, argc, argv, VM_BLOCK_HANDLER_NONE);
+	cont->value = rb_vm_invoke_proc(th->ec, proc, argc, argv, VM_BLOCK_HANDLER_NONE);
     }
     EC_POP_TAG();
 
Index: vm.c
===================================================================
--- vm.c	(revision 60475)
+++ vm.c	(revision 60476)
@@ -291,11 +291,8 @@ static void vm_collect_usage_register(in https://github.com/ruby/ruby/blob/trunk/vm.c#L291
 #endif
 
 static VALUE vm_make_env_object(const rb_execution_context_t *ec, rb_control_frame_t *cfp);
-
-static VALUE vm_invoke_bmethod(rb_thread_t *th, rb_proc_t *proc, VALUE self,
-			       int argc, const VALUE *argv, VALUE block_handler);
-static VALUE vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
-			    int argc, const VALUE *argv, VALUE block_handler);
+static VALUE vm_invoke_bmethod(rb_execution_context_t *ec, rb_proc_t *proc, VALUE self, int argc, const VALUE *argv, VALUE block_handler);
+static VALUE vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, VALUE self, int argc, const VALUE *argv, VALUE block_handler);
 
 #include "vm_insnhelper.h"
 #include "vm_exec.h"
@@ -972,53 +969,54 @@ rb_binding_add_dynavars(VALUE bindval, r https://github.com/ruby/ruby/blob/trunk/vm.c#L969
 /* C -> Ruby: block */
 
 static inline VALUE
-invoke_block(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const struct rb_captured_block *captured, const rb_cref_t *cref, VALUE type, int opt_pc)
+invoke_block(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE self, const struct rb_captured_block *captured, const rb_cref_t *cref, VALUE type, int opt_pc)
 {
     int arg_size = iseq->body->param.size;
 
-    vm_push_frame(th->ec, iseq, type | VM_FRAME_FLAG_FINISH, self,
+    vm_push_frame(ec, iseq, type | VM_FRAME_FLAG_FINISH, self,
 		  VM_GUARDED_PREV_EP(captured->ep),
 		  (VALUE)cref, /* cref or method */
 		  iseq->body->iseq_encoded + opt_pc,
-		  th->ec->cfp->sp + arg_size,
+		  ec->cfp->sp + arg_size,
 		  iseq->body->local_table_size - arg_size,
 		  iseq->body->stack_max);
-    return vm_exec(th);
+    return vm_exec(rb_ec_thread_ptr(ec));
 }
 
 static VALUE
-invoke_bmethod(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const struct rb_captured_block *captured, const rb_callable_method_entry_t *me, VALUE type, int opt_pc)
+invoke_bmethod(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE self, const struct rb_captured_block *captured, const rb_callable_method_entry_t *me, VALUE type, int opt_pc)
 {
     /* bmethod */
     int arg_size = iseq->body->param.size;
     VALUE ret;
 
-    vm_push_frame(th->ec, iseq, type | VM_FRAME_FLAG_BMETHOD, self,
+    vm_push_frame(ec, iseq, type | VM_FRAME_FLAG_BMETHOD, self,
 		  VM_GUARDED_PREV_EP(captured->ep),
 		  (VALUE)me,
 		  iseq->body->iseq_encoded + opt_pc,
-		  th->ec->cfp->sp + arg_size,
+		  ec->cfp->sp + arg_size,
 		  iseq->body->local_table_size - arg_size,
 		  iseq->body->stack_max);
 
-    RUBY_DTRACE_METHOD_ENTRY_HOOK(th, me->owner, me->def->original_id);
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_CALL, self, me->def->original_id, me->called_id, me->owner, Qnil);
-    VM_ENV_FLAGS_SET(th->ec->cfp->ep, VM_FRAME_FLAG_FINISH);
-    ret = vm_exec(th);
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_RETURN, self, me->def->original_id, me->called_id, me->owner, ret);
-    RUBY_DTRACE_METHOD_RETURN_HOOK(th, me->owner, me->def->original_id);
+    RUBY_DTRACE_METHOD_ENTRY_HOOK(rb_ec_thread_ptr(ec), me->owner, me->def->original_id);
+    EXEC_EVENT_HOOK(rb_ec_thread_ptr(ec), RUBY_EVENT_CALL, self, me->def->original_id, me->called_id, me->owner, Qnil);
+    VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);
+    ret = vm_exec(rb_ec_thread_ptr(ec));
+    EXEC_EVENT_HOOK(rb_ec_thread_ptr(ec), RUBY_EVENT_RETURN, self, me->def->original_id, me->called_id, me->owner, ret);
+    RUBY_DTRACE_METHOD_RETURN_HOOK(rb_ec_thread_ptr(ec), me->owner, me->def->original_id);
     return ret;
 }
 
 static inline VALUE
-invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captured,
+invoke_iseq_block_from_c(rb_execution_context_t *ec, const struct rb_captured_block *captured,
 			 VALUE self, int argc, const VALUE *argv, VALUE passed_block_handler,
 			 const rb_cref_t *cref, int is_lambda)
 {
+    rb_thread_t *th = rb_ec_thread_ptr(ec);
     const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
     int i, opt_pc;
     VALUE type = VM_FRAME_MAGIC_BLOCK | (is_lambda ? VM_FRAME_FLAG_LAMBDA : 0);
-    rb_control_frame_t *cfp = th->ec->cfp;
+    rb_control_frame_t *cfp = ec->cfp;
     VALUE *sp = cfp->sp;
     const rb_callable_method_entry_t *me = th->passed_bmethod_me;
     th->passed_bmethod_me = NULL;
@@ -1030,20 +1028,20 @@ invoke_iseq_block_from_c(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/vm.c#L1028
 	sp[i] = argv[i];
     }
 
-    opt_pc = vm_yield_setup_args(th, iseq, argc, sp, passed_block_handler,
+    opt_pc = vm_yield_setup_args(ec, iseq, argc, sp, passed_block_handler,
 				 (is_lambda ? arg_setup_method : arg_setup_block));
     cfp->sp = sp;
 
     if (me == NULL) {
-	return invoke_block(th, iseq, self, captured, cref, type, opt_pc);
+	return invoke_block(ec, iseq, self, captured, cref, type, opt_pc);
     }
     else {
-	return invoke_bmethod(th, iseq, self, captured, me, type, opt_pc);
+	return invoke_bmethod(ec, iseq, self, captured, me, type, opt_pc);
     }
 }
 
 static inline VALUE
-invoke_block_from_c_bh(rb_thread_t *th, VALUE block_handler,
+invoke_block_from_c_bh(rb_execution_context_t *ec, VALUE block_handler,
 		       int argc, const VALUE *argv,
 		       VALUE passed_block_handler, const rb_cref_t *cref,
 		       int is_lambda, int force_blockarg)
@@ -1053,16 +1051,16 @@ invoke_block_from_c_bh(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm.c#L1051
       case block_handler_type_iseq:
 	{
 	    const struct rb_captured_block *captured = VM_BH_TO_ISEQ_BLOCK(block_handler);
-	    return invoke_iseq_block_from_c(th, captured, captured->self,
+	    return invoke_iseq_block_from_c(ec, captured, captured->self,
 					    argc, argv, passed_block_handler,
 					    cref, is_lambda);
 	}
       case block_handler_type_ifunc:
-	return vm_yield_with_cfunc(th, VM_BH_TO_IFUNC_BLOCK(block_handler),
+	return vm_yield_with_cfunc(ec, VM_BH_TO_IFUNC_BLOCK(block_handler),
 				   VM_BH_TO_IFUNC_BLOCK(block_handler)->self,
 				   argc, argv, passed_block_handler);
       case block_handler_type_symbol:
-	return vm_yield_with_symbol(th, VM_BH_TO_SYMBOL(block_handler),
+	return vm_yield_with_symbol(ec, VM_BH_TO_SYMBOL(block_handler),
 				    argc, argv, passed_block_handler);
       case block_handler_type_proc:
 	if (force_blockarg == FALSE) {
@@ -1076,9 +1074,9 @@ invoke_block_from_c_bh(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm.c#L1074
 }
 
 static inline VALUE
-check_block_handler(rb_thread_t *th)
+check_block_handler(rb_execution_context_t *ec)
 {
-    VALUE block_handler = VM_CF_BLOCK_HANDLER(th->ec->cfp);
+    VALUE block_handler = VM_CF_BLOCK_HANDLER(ec->cfp);
     vm_block_handler_verify(block_handler);
     if (UNLIKELY(block_handler == VM_BLOCK_HANDLER_NONE)) {
 	rb_vm_localjump_error("no block given", Qnil, 0);
@@ -1088,38 +1086,38 @@ check_block_handler(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1086
 }
 
 static VALUE
-vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref, int is_lambda)
+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(th, check_block_handler(th),
+    return invoke_block_from_c_bh(ec, check_block_handler(ec),
 				  argc, argv, VM_BLOCK_HANDLER_NONE,
 				  cref, is_lambda, FALSE);
 }
 
 static VALUE
-vm_yield(rb_thread_t *th, int argc, const VALUE *argv)
+vm_yield(rb_execution_context_t *ec, int argc, const VALUE *argv)
 {
-    return invoke_block_from_c_bh(th, check_block_handler(th),
+    return invoke_block_from_c_bh(ec, check_block_handler(ec),
 				  argc, argv, VM_BLOCK_HANDLER_NONE,
 				  NULL, FALSE, FALSE);
 }
 
 static VALUE
-vm_yield_with_block(rb_thread_t *th, int argc, const VALUE *argv, VALUE block_handler)
+vm_yield_with_block(rb_execution_context_t *ec, int argc, const VALUE *argv, VALUE block_handler)
 {
-    return invoke_block_from_c_bh(th, check_block_handler(th),
+    return invoke_block_from_c_bh(ec, check_block_handler(ec),
 				  argc, argv, block_handler,
 				  NULL, FALSE, FALSE);
 }
 
 static VALUE
-vm_yield_force_blockarg(rb_thread_t *th, VALUE args)
+vm_yield_force_blockarg(rb_execution_context_t *ec, VALUE args)
 {
-    return invoke_block_from_c_bh(th, check_block_handler(th), 1, &args,
+    return invoke_block_from_c_bh(ec, check_block_handler(ec), 1, &args,
 				  VM_BLOCK_HANDLER_NONE, NULL, FALSE, TRUE);
 }
 
 static inline VALUE
-invoke_block_from_c_proc(rb_thread_t *th, const rb_proc_t *proc,
+invoke_block_from_c_proc(rb_execution_context_t *ec, const rb_proc_t *proc,
 			 VALUE self, int argc, const VALUE *argv,
 			 VALUE passed_block_handler, int is_lambda)
 {
@@ -1128,11 +1126,11 @@ invoke_block_from_c_proc(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/vm.c#L1126
   again:
     switch (vm_block_type(block)) {
       case block_type_iseq:
-	return invoke_iseq_block_from_c(th, &block->as.captured, self, argc, argv, passed_block_handler, NULL, is_lambda);
+	return invoke_iseq_block_from_c(ec, &block->as.captured, self, argc, argv, passed_block_handler, NULL, is_lambda);
       case block_type_ifunc:
-	return vm_yield_with_cfunc(th, &block->as.captured, self, argc, argv, passed_block_handler);
+	return vm_yield_with_cfunc(ec, &block->as.captured, self, argc, argv, passed_block_handler);
       case block_type_symbol:
-	return vm_yield_with_symbol(th, block->as.symbol, argc, argv, passed_block_handler);
+	return vm_yield_with_symbol(ec, block->as.symbol, argc, argv, passed_block_handler);
       case block_type_proc:
 	is_lambda = block_proc_is_lambda(block->as.proc);
 	block = vm_proc_block(block->as.proc);
@@ -1143,47 +1141,47 @@ invoke_block_from_c_proc(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/vm.c#L1141
 }
 
 static VALUE
-vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
+vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, VALUE self,
 	       int argc, const VALUE *argv, VALUE passed_block_handler)
 {
     VALUE val = Qundef;
     enum ruby_tag_type state;
-    volatile int stored_safe = th->ec->safe_level;
+    volatile int stored_safe = ec->safe_level;
 
-    EC_PUSH_TAG(th->ec);
+    EC_PUSH_TAG(ec);
     if ((state = EXEC_TAG()) == TAG_NONE) {
-	th->ec->safe_level = proc->safe_level;
-	val = invoke_block_from_c_proc(th, proc, self, argc, argv, passed_block_handler, proc->is_lambda);
+	ec->safe_level = proc->safe_level;
+	val = invoke_block_from_c_proc(ec, proc, self, argc, argv, passed_block_handler, proc->is_lambda);
     }
     EC_POP_TAG();
 
-    th->ec->safe_level = stored_safe;
+    ec->safe_level = stored_safe;
 
     if (state) {
-	EC_JUMP_TAG(th->ec, state);
+	EC_JUMP_TAG(ec, state);
     }
     return val;
 }
 
 static VALUE
-vm_invoke_bmethod(rb_thread_t *th, rb_proc_t *proc, VALUE self,
+vm_invoke_bmethod(rb_execution_context_t *ec, rb_proc_t *proc, VALUE self,
 		  int argc, const VALUE *argv, VALUE block_handler)
 {
-    return invoke_block_from_c_proc(th, (... truncated)

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

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