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

ruby-changes:53358

From: shyouhei <ko1@a...>
Date: Tue, 6 Nov 2018 19:20:01 +0900 (JST)
Subject: [ruby-changes:53358] shyouhei:r65574 (trunk): cont.c: direct use of rb_thread_t

shyouhei	2018-11-06 19:19:55 +0900 (Tue, 06 Nov 2018)

  New Revision: 65574

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

  Log:
    cont.c: direct use of rb_thread_t
    
    The only usage of rb_fiber_reset_root_local_storage() is from
    ruby_vm_destruct(), where the object space is already terminated.
    This `th->self` is not alive.  Why not just use `th` itself.
    
    See also: https://travis-ci.org/ruby/ruby/jobs/451294954

  Modified files:
    trunk/cont.c
    trunk/internal.h
    trunk/vm.c
Index: internal.h
===================================================================
--- internal.h	(revision 65573)
+++ internal.h	(revision 65574)
@@ -1374,9 +1374,10 @@ VALUE rb_complex_sqrt(VALUE x); https://github.com/ruby/ruby/blob/trunk/internal.h#L1374
 VALUE rb_dbl_complex_polar_pi(double abs, double ang);
 VALUE rb_complex_pow(VALUE self, VALUE other);
 
+struct rb_thread_struct;
 /* cont.c */
 VALUE rb_obj_is_fiber(VALUE);
-void rb_fiber_reset_root_local_storage(VALUE);
+void rb_fiber_reset_root_local_storage(struct rb_thread_struct *);
 void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*rollback_func)(ANYARGS));
 
 /* debug.c */
Index: vm.c
===================================================================
--- vm.c	(revision 65573)
+++ vm.c	(revision 65574)
@@ -2201,7 +2201,7 @@ ruby_vm_destruct(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/vm.c#L2201
 	struct rb_objspace *objspace = vm->objspace;
 	vm->main_thread = 0;
 	if (th) {
-	    rb_fiber_reset_root_local_storage(th->self);
+	    rb_fiber_reset_root_local_storage(th);
 	    thread_free(th);
 	}
 	rb_vm_living_threads_init(vm);
Index: cont.c
===================================================================
--- cont.c	(revision 65573)
+++ cont.c	(revision 65574)
@@ -1833,10 +1833,8 @@ rb_fiber_yield(int argc, const VALUE *ar https://github.com/ruby/ruby/blob/trunk/cont.c#L1833
 }
 
 void
-rb_fiber_reset_root_local_storage(VALUE thval)
+rb_fiber_reset_root_local_storage(rb_thread_t *th)
 {
-    rb_thread_t *th = rb_thread_ptr(thval);
-
     if (th->root_fiber && th->root_fiber != th->ec->fiber_ptr) {
 	th->ec->local_storage = th->root_fiber->cont.saved_ec.local_storage;
     }

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

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