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

ruby-changes:48392

From: ko1 <ko1@a...>
Date: Sat, 28 Oct 2017 19:36:00 +0900 (JST)
Subject: [ruby-changes:48392] ko1:r60506 (trunk): `th` -> `ec` for vm_exec().

ko1	2017-10-28 19:35:55 +0900 (Sat, 28 Oct 2017)

  New Revision: 60506

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

  Log:
    `th` -> `ec` for vm_exec().
    
    * vm.c (vm_exec): accepts `ec` instead of `th`.

  Modified files:
    trunk/vm.c
    trunk/vm_eval.c
Index: vm.c
===================================================================
--- vm.c	(revision 60505)
+++ vm.c	(revision 60506)
@@ -981,7 +981,7 @@ invoke_block(rb_execution_context_t *ec, https://github.com/ruby/ruby/blob/trunk/vm.c#L981
 		  ec->cfp->sp + arg_size,
 		  iseq->body->local_table_size - arg_size,
 		  iseq->body->stack_max);
-    return vm_exec(rb_ec_thread_ptr(ec));
+    return vm_exec(ec);
 }
 
 static VALUE
@@ -1002,7 +1002,7 @@ invoke_bmethod(rb_execution_context_t *e https://github.com/ruby/ruby/blob/trunk/vm.c#L1002
     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));
+    ret = vm_exec(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;
@@ -1783,20 +1783,20 @@ hook_before_rewind(rb_thread_t *th, cons https://github.com/ruby/ruby/blob/trunk/vm.c#L1783
  */
 
 static VALUE
-vm_exec(rb_thread_t *th)
+vm_exec(rb_execution_context_t *ec)
 {
     enum ruby_tag_type state;
     VALUE result;
     VALUE initial = 0;
     struct vm_throw_data *err;
 
-    EC_PUSH_TAG(th->ec);
+    EC_PUSH_TAG(ec);
 
     _tag.retval = Qnil;
     if ((state = EXEC_TAG()) == TAG_NONE) {
       vm_loop_start:
-	result = vm_exec_core(th->ec, initial);
-	VM_ASSERT(th->ec->tag == &_tag);
+	result = vm_exec_core(ec, initial);
+	VM_ASSERT(ec->tag == &_tag);
 	if ((state = _tag.state) != TAG_NONE) {
 	    err = (struct vm_throw_data *)result;
 	    _tag.state = TAG_NONE;
@@ -1813,27 +1813,27 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1813
 	VALUE type;
 	const rb_control_frame_t *escape_cfp;
 
-	err = (struct vm_throw_data *)th->ec->errinfo;
-	rb_thread_raised_reset(th, RAISED_STACKOVERFLOW);
+	err = (struct vm_throw_data *)ec->errinfo;
+	rb_thread_raised_reset(rb_ec_thread_ptr(ec), RAISED_STACKOVERFLOW);
 
       exception_handler:
 	cont_pc = cont_sp = 0;
 	catch_iseq = NULL;
 
-	while (th->ec->cfp->pc == 0 || th->ec->cfp->iseq == 0) {
-	    if (UNLIKELY(VM_FRAME_TYPE(th->ec->cfp) == VM_FRAME_MAGIC_CFUNC)) {
-		EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, th->ec->cfp->self,
-				rb_vm_frame_method_entry(th->ec->cfp)->def->original_id,
-				rb_vm_frame_method_entry(th->ec->cfp)->called_id,
-				rb_vm_frame_method_entry(th->ec->cfp)->owner, Qnil);
-		RUBY_DTRACE_CMETHOD_RETURN_HOOK(th,
-					       rb_vm_frame_method_entry(th->ec->cfp)->owner,
-					       rb_vm_frame_method_entry(th->ec->cfp)->def->original_id);
+	while (ec->cfp->pc == 0 || ec->cfp->iseq == 0) {
+	    if (UNLIKELY(VM_FRAME_TYPE(ec->cfp) == VM_FRAME_MAGIC_CFUNC)) {
+		EXEC_EVENT_HOOK(rb_ec_thread_ptr(ec), RUBY_EVENT_C_RETURN, ec->cfp->self,
+				rb_vm_frame_method_entry(ec->cfp)->def->original_id,
+				rb_vm_frame_method_entry(ec->cfp)->called_id,
+				rb_vm_frame_method_entry(ec->cfp)->owner, Qnil);
+		RUBY_DTRACE_CMETHOD_RETURN_HOOK(rb_ec_thread_ptr(ec),
+						rb_vm_frame_method_entry(ec->cfp)->owner,
+						rb_vm_frame_method_entry(ec->cfp)->def->original_id);
 	    }
-	    rb_vm_pop_frame(th->ec);
+	    rb_vm_pop_frame(ec);
 	}
 
-	cfp = th->ec->cfp;
+	cfp = ec->cfp;
 	epc = cfp->pc - cfp->iseq->body->iseq_encoded;
 
 	escape_cfp = NULL;
@@ -1860,11 +1860,11 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1860
 			    }
 			}
 			if (catch_iseq == NULL) {
-			    th->ec->errinfo = Qnil;
+			    ec->errinfo = Qnil;
 			    result = THROW_DATA_VAL(err);
 			    THROW_DATA_CATCH_FRAME_SET(err, cfp + 1);
-			    hook_before_rewind(th, th->ec->cfp, TRUE, state, err);
-			    rb_vm_pop_frame(th->ec);
+			    hook_before_rewind(rb_ec_thread_ptr(ec), ec->cfp, TRUE, state, err);
+			    rb_vm_pop_frame(ec);
 			    goto finish_vme;
 			}
 		    }
@@ -1875,9 +1875,9 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1875
 #if OPT_STACK_CACHING
 		    initial = THROW_DATA_VAL(err);
 #else
-		    *th->ec->cfp->sp++ = THROW_DATA_VAL(err);
+		    *ec->cfp->sp++ = THROW_DATA_VAL(err);
 #endif
-		    th->ec->errinfo = Qnil;
+		    ec->errinfo = Qnil;
 		    goto vm_loop_start;
 		}
 	    }
@@ -1916,7 +1916,7 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1916
 			escape_cfp = THROW_DATA_CATCH_FRAME(err);
 			if (cfp == escape_cfp) {
 			    cfp->pc = cfp->iseq->body->iseq_encoded + entry->cont;
-			    th->ec->errinfo = Qnil;
+			    ec->errinfo = Qnil;
 			    goto vm_loop_start;
 			}
 		    }
@@ -1946,11 +1946,11 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1946
 #if OPT_STACK_CACHING
 			    initial = THROW_DATA_VAL(err);
 #else
-			    *th->ec->cfp->sp++ = THROW_DATA_VAL(err);
+			    *ec->cfp->sp++ = THROW_DATA_VAL(err);
 #endif
 			}
-			th->ec->errinfo = Qnil;
-			VM_ASSERT(th->ec->tag->state == TAG_NONE);
+			ec->errinfo = Qnil;
+			VM_ASSERT(ec->tag->state == TAG_NONE);
 			goto vm_loop_start;
 		    }
 		}
@@ -1990,7 +1990,7 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1990
 
 	    /* push block frame */
 	    cfp->sp[0] = (VALUE)err;
-	    vm_push_frame(th->ec, catch_iseq, VM_FRAME_MAGIC_RESCUE,
+	    vm_push_frame(ec, catch_iseq, VM_FRAME_MAGIC_RESCUE,
 			  cfp->self,
 			  VM_GUARDED_PREV_EP(cfp->ep),
 			  0, /* cref or me */
@@ -2000,21 +2000,21 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L2000
 			  catch_iseq->body->stack_max);
 
 	    state = 0;
-	    th->ec->tag->state = TAG_NONE;
-	    th->ec->errinfo = Qnil;
+	    ec->tag->state = TAG_NONE;
+	    ec->errinfo = Qnil;
 	    goto vm_loop_start;
 	}
 	else {
-	    hook_before_rewind(th, th->ec->cfp, FALSE, state, err);
+	    hook_before_rewind(rb_ec_thread_ptr(ec), ec->cfp, FALSE, state, err);
 
-	    if (VM_FRAME_FINISHED_P(th->ec->cfp)) {
-		rb_vm_pop_frame(th->ec);
-		th->ec->errinfo = (VALUE)err;
+	    if (VM_FRAME_FINISHED_P(ec->cfp)) {
+		rb_vm_pop_frame(ec);
+		ec->errinfo = (VALUE)err;
 		EC_TMPPOP_TAG();
-		EC_JUMP_TAG(th->ec, state);
+		EC_JUMP_TAG(ec, state);
 	    }
 	    else {
-		rb_vm_pop_frame(th->ec);
+		rb_vm_pop_frame(ec);
 		goto exception_handler;
 	    }
 	}
@@ -2029,21 +2029,21 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L2029
 VALUE
 rb_iseq_eval(const rb_iseq_t *iseq)
 {
-    rb_thread_t *th = GET_THREAD();
+    rb_execution_context_t *ec = GET_EC();
     VALUE val;
-    vm_set_top_stack(th->ec, iseq);
-    val = vm_exec(th);
+    vm_set_top_stack(ec, iseq);
+    val = vm_exec(ec);
     return val;
 }
 
 VALUE
 rb_iseq_eval_main(const rb_iseq_t *iseq)
 {
-    rb_thread_t *th = GET_THREAD();
+    rb_execution_context_t *ec = GET_EC();
     VALUE val;
 
-    vm_set_main_stack(th->ec, iseq);
-    val = vm_exec(th);
+    vm_set_main_stack(ec, iseq);
+    val = vm_exec(ec);
     return val;
 }
 
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 60505)
+++ vm_eval.c	(revision 60506)
@@ -20,7 +20,7 @@ static inline VALUE vm_yield_with_cref(r https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L20
 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 VALUE vm_exec(rb_execution_context_t *ec);
 static void vm_set_eval_stack(rb_execution_context_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);
 
@@ -124,7 +124,7 @@ vm_call0_body(rb_execution_context_t *ec https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L124
 
 	    vm_call_iseq_setup(ec, reg_cfp, calling, ci, cc);
 	    VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);
-	    return vm_exec(rb_ec_thread_ptr(ec)); /* CHECK_INTS in this function */
+	    return vm_exec(ec); /* CHECK_INTS in this function */
 	}
       case VM_METHOD_TYPE_NOTIMPLEMENTED:
       case VM_METHOD_TYPE_CFUNC:
@@ -1344,12 +1344,12 @@ eval_string_with_cref(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1344
 
     if (file != Qundef) {
 	/* kick */
-	return vm_exec(rb_ec_thread_ptr(ec));
+	return vm_exec(ec);
     }
 
     EC_PUSH_TAG(ec);
     if ((state = EC_EXEC_TAG()) == TAG_NONE) {
-	result = vm_exec(rb_ec_thread_ptr(ec));
+	result = vm_exec(ec);
     }
     EC_POP_TAG();
 

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

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