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

ruby-changes:48353

From: ko1 <ko1@a...>
Date: Fri, 27 Oct 2017 10:35:16 +0900 (JST)
Subject: [ruby-changes:48353] ko1:r60467 (trunk): vm_throw* accept `ec` instead of `th`.

ko1	2017-10-27 10:35:12 +0900 (Fri, 27 Oct 2017)

  New Revision: 60467

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

  Log:
    vm_throw* accept `ec` instead of `th`.
    
    * vm_insnhelper.c (vm_throw*): accept `ec` instead of `th`.

  Modified files:
    trunk/insns.def
    trunk/vm_insnhelper.c
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 60466)
+++ vm_insnhelper.c	(revision 60467)
@@ -1046,31 +1046,31 @@ vm_setinstancevariable(VALUE obj, ID id, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1046
 }
 
 static VALUE
-vm_throw_continue(rb_thread_t *th, VALUE err)
+vm_throw_continue(const rb_execution_context_t *ec, VALUE err)
 {
     /* continue throw */
 
     if (FIXNUM_P(err)) {
-	th->ec->tag->state = FIX2INT(err);
+	ec->tag->state = FIX2INT(err);
     }
     else if (SYMBOL_P(err)) {
-	th->ec->tag->state = TAG_THROW;
+	ec->tag->state = TAG_THROW;
     }
     else if (THROW_DATA_P(err)) {
-	th->ec->tag->state = THROW_DATA_STATE((struct vm_throw_data *)err);
+	ec->tag->state = THROW_DATA_STATE((struct vm_throw_data *)err);
     }
     else {
-	th->ec->tag->state = TAG_RAISE;
+	ec->tag->state = TAG_RAISE;
     }
     return err;
 }
 
 static VALUE
-vm_throw_start(rb_thread_t *const th, rb_control_frame_t *const reg_cfp, enum ruby_tag_type state,
+vm_throw_start(const rb_execution_context_t *ec, rb_control_frame_t *const reg_cfp, enum ruby_tag_type state,
 	       const int flag, const rb_num_t level, const VALUE throwobj)
 {
     const rb_control_frame_t *escape_cfp = NULL;
-    const rb_control_frame_t * const eocfp = RUBY_VM_END_CONTROL_FRAME(th->ec); /* end of control frame pointer */
+    const rb_control_frame_t * const eocfp = RUBY_VM_END_CONTROL_FRAME(ec); /* end of control frame pointer */
 
     if (flag != 0) {
 	/* do nothing */
@@ -1090,7 +1090,7 @@ vm_throw_start(rb_thread_t *const th, rb https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1090
 	    else {
 		ep = VM_ENV_PREV_EP(ep);
 		base_iseq = base_iseq->body->parent_iseq;
-		escape_cfp = rb_vm_search_cf_from_ep(th->ec, escape_cfp, ep);
+		escape_cfp = rb_vm_search_cf_from_ep(ec, escape_cfp, ep);
 		VM_ASSERT(escape_cfp->iseq == base_iseq);
 	    }
 	}
@@ -1142,7 +1142,7 @@ vm_throw_start(rb_thread_t *const th, rb https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1142
 	    ep = VM_ENV_PREV_EP(ep);
 	}
 
-	escape_cfp = rb_vm_search_cf_from_ep(th->ec, reg_cfp, ep);
+	escape_cfp = rb_vm_search_cf_from_ep(ec, reg_cfp, ep);
     }
     else if (state == TAG_RETURN) {
 	const VALUE *current_ep = GET_EP();
@@ -1215,12 +1215,12 @@ vm_throw_start(rb_thread_t *const th, rb https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1215
 	rb_bug("isns(throw): unsupport throw type");
     }
 
-    th->ec->tag->state = state;
+    ec->tag->state = state;
     return (VALUE)THROW_DATA_NEW(throwobj, escape_cfp, state);
 }
 
 static VALUE
-vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp,
+vm_throw(const rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
 	 rb_num_t throw_state, VALUE throwobj)
 {
     const int state = (int)(throw_state & VM_THROW_STATE_MASK);
@@ -1228,10 +1228,10 @@ vm_throw(rb_thread_t *th, rb_control_fra https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1228
     const rb_num_t level = throw_state >> VM_THROW_LEVEL_SHIFT;
 
     if (state != 0) {
-	return vm_throw_start(th, reg_cfp, state, flag, level, throwobj);
+	return vm_throw_start(ec, reg_cfp, state, flag, level, throwobj);
     }
     else {
-	return vm_throw_continue(th, throwobj);
+	return vm_throw_continue(ec, throwobj);
     }
 }
 
Index: insns.def
===================================================================
--- insns.def	(revision 60466)
+++ insns.def	(revision 60467)
@@ -1025,7 +1025,7 @@ throw https://github.com/ruby/ruby/blob/trunk/insns.def#L1025
 (VALUE val)
 {
     RUBY_VM_CHECK_INTS(th);
-    val = vm_throw(th, GET_CFP(), throw_state, throwobj);
+    val = vm_throw(th->ec, GET_CFP(), throw_state, throwobj);
     THROW_EXCEPTION(val);
     /* unreachable */
 }

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

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