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

ruby-changes:48442

From: ko1 <ko1@a...>
Date: Mon, 30 Oct 2017 00:03:40 +0900 (JST)
Subject: [ruby-changes:48442] ko1:r60556 (trunk): * vm_eval.c (vm_catch_protect): accepts `ec` instead of `th`.

ko1	2017-10-30 00:03:33 +0900 (Mon, 30 Oct 2017)

  New Revision: 60556

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

  Log:
    * vm_eval.c (vm_catch_protect): accepts `ec` instead of `th`.

  Modified files:
    trunk/vm_eval.c
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 60555)
+++ vm_eval.c	(revision 60556)
@@ -1984,13 +1984,13 @@ rb_catch(const char *tag, VALUE (*func)( https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1984
 
 static VALUE
 vm_catch_protect(VALUE tag, rb_block_call_func *func, VALUE data,
-		 enum ruby_tag_type *stateptr, rb_thread_t *volatile th)
+		 enum ruby_tag_type *stateptr, rb_execution_context_t *volatile ec)
 {
     enum ruby_tag_type state;
     VALUE val = Qnil;		/* OK */
-    rb_control_frame_t *volatile saved_cfp = th->ec->cfp;
+    rb_control_frame_t *volatile saved_cfp = ec->cfp;
 
-    EC_PUSH_TAG(th->ec);
+    EC_PUSH_TAG(ec);
 
     _tag.tag = tag;
 
@@ -1998,10 +1998,10 @@ vm_catch_protect(VALUE tag, rb_block_cal https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1998
 	/* call with argc=1, argv = [tag], block = Qnil to insure compatibility */
 	val = (*func)(tag, data, 1, (const VALUE *)&tag, Qnil);
     }
-    else if (state == TAG_THROW && THROW_DATA_VAL((struct vm_throw_data *)th->ec->errinfo) == tag) {
-	rb_vm_rewind_cfp(th->ec, saved_cfp);
-	val = th->ec->tag->retval;
-	th->ec->errinfo = Qnil;
+    else if (state == TAG_THROW && THROW_DATA_VAL((struct vm_throw_data *)ec->errinfo) == tag) {
+	rb_vm_rewind_cfp(ec, saved_cfp);
+	val = ec->tag->retval;
+	ec->errinfo = Qnil;
 	state = 0;
     }
     EC_POP_TAG();
@@ -2014,16 +2014,16 @@ vm_catch_protect(VALUE tag, rb_block_cal https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L2014
 VALUE
 rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, enum ruby_tag_type *stateptr)
 {
-    return vm_catch_protect(t, func, data, stateptr, GET_THREAD());
+    return vm_catch_protect(t, func, data, stateptr, GET_EC());
 }
 
 VALUE
 rb_catch_obj(VALUE t, VALUE (*func)(), VALUE data)
 {
     enum ruby_tag_type state;
-    rb_thread_t *th = GET_THREAD();
-    VALUE val = vm_catch_protect(t, (rb_block_call_func *)func, data, &state, th);
-    if (state) EC_JUMP_TAG(th->ec, state);
+    rb_execution_context_t *ec = GET_EC();
+    VALUE val = vm_catch_protect(t, (rb_block_call_func *)func, data, &state, ec);
+    if (state) EC_JUMP_TAG(ec, state);
     return val;
 }
 

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

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