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

ruby-changes:48346

From: ko1 <ko1@a...>
Date: Fri, 27 Oct 2017 08:34:04 +0900 (JST)
Subject: [ruby-changes:48346] ko1:r60460 (trunk): rb_vm_bh_to_procval() accepts `ec` instead of `th`.

ko1	2017-10-27 08:33:59 +0900 (Fri, 27 Oct 2017)

  New Revision: 60460

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

  Log:
    rb_vm_bh_to_procval() accepts `ec` instead of `th`.
    
    * vm_insnhelper.c (rb_vm_bh_to_procval): accepts `ec` instead of `th`.

  Modified files:
    trunk/insns.def
    trunk/proc.c
    trunk/vm_args.c
    trunk/vm_insnhelper.c
Index: vm_args.c
===================================================================
--- vm_args.c	(revision 60459)
+++ vm_args.c	(revision 60460)
@@ -477,7 +477,7 @@ static inline void https://github.com/ruby/ruby/blob/trunk/vm_args.c#L477
 args_setup_block_parameter(rb_thread_t *th, struct rb_calling_info *calling, VALUE *locals)
 {
     VALUE block_handler = calling->block_handler;
-    *locals = rb_vm_bh_to_procval(th, block_handler);
+    *locals = rb_vm_bh_to_procval(th->ec, block_handler);
 }
 
 struct fill_values_arg {
Index: insns.def
===================================================================
--- insns.def	(revision 60459)
+++ insns.def	(revision 60460)
@@ -95,7 +95,7 @@ getblockparam https://github.com/ruby/ruby/blob/trunk/insns.def#L95
     VM_ASSERT(VM_ENV_LOCAL_P(ep));
 
     if (!VM_ENV_FLAGS(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM)) {
-	val = rb_vm_bh_to_procval(th, VM_ENV_BLOCK_HANDLER(ep));
+	val = rb_vm_bh_to_procval(th->ec, VM_ENV_BLOCK_HANDLER(ep));
 	vm_env_write(ep, -(int)idx, val);
 	VM_ENV_FLAGS_SET(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM);
     }
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 60459)
+++ vm_insnhelper.c	(revision 60460)
@@ -345,7 +345,7 @@ rb_vm_env_write(const VALUE *ep, int ind https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L345
 }
 
 VALUE
-rb_vm_bh_to_procval(rb_thread_t *th, VALUE block_handler)
+rb_vm_bh_to_procval(rb_execution_context_t *ec, VALUE block_handler)
 {
     if (block_handler == VM_BLOCK_HANDLER_NONE) {
 	return Qnil;
@@ -354,7 +354,7 @@ rb_vm_bh_to_procval(rb_thread_t *th, VAL https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L354
 	switch (vm_block_handler_type(block_handler)) {
 	  case block_handler_type_iseq:
 	  case block_handler_type_ifunc:
-	    return rb_vm_make_proc(th->ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc);
+	    return rb_vm_make_proc(ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc);
 	  case block_handler_type_symbol:
 	    return rb_sym_to_proc(VM_BH_TO_SYMBOL(block_handler));
 	  case block_handler_type_proc:
Index: proc.c
===================================================================
--- proc.c	(revision 60459)
+++ proc.c	(revision 60460)
@@ -384,8 +384,6 @@ bind_eval(int argc, VALUE *argv, VALUE b https://github.com/ruby/ruby/blob/trunk/proc.c#L384
     return rb_f_eval(argc+1, args, Qnil /* self will be searched in eval */);
 }
 
-VALUE rb_vm_bh_to_procval(rb_thread_t *th, VALUE block_handler);
-
 static const VALUE *
 get_local_variable_ptr(const rb_env_t **envp, ID lid)
 {
@@ -404,7 +402,7 @@ get_local_variable_ptr(const rb_env_t ** https://github.com/ruby/ruby/blob/trunk/proc.c#L402
 			(unsigned int)iseq->body->param.block_start == i) {
 			const VALUE *ep = env->ep;
 			if (!VM_ENV_FLAGS(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM)) {
-			    RB_OBJ_WRITE(env, &env->env[i], rb_vm_bh_to_procval(GET_THREAD(), VM_ENV_BLOCK_HANDLER(ep)));
+			    RB_OBJ_WRITE(env, &env->env[i], rb_vm_bh_to_procval(GET_EC(), VM_ENV_BLOCK_HANDLER(ep)));
 			    VM_ENV_FLAGS_SET(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM);
 			}
 		    }

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

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