ruby-changes:47061
From: ko1 <ko1@a...>
Date: Mon, 26 Jun 2017 16:46:17 +0900 (JST)
Subject: [ruby-changes:47061] ko1:r59176 (trunk): copy ec on Fiber.
ko1 2017-06-26 16:46:11 +0900 (Mon, 26 Jun 2017) New Revision: 59176 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59176 Log: copy ec on Fiber. * cont.c (cont_restore_thread): on Fiber we only need to copy ec struct. Modified files: trunk/cont.c Index: cont.c =================================================================== --- cont.c (revision 59175) +++ cont.c (revision 59176) @@ -545,22 +545,24 @@ cont_restore_thread(rb_context_t *cont) https://github.com/ruby/ruby/blob/trunk/cont.c#L545 #else MEMCPY(th->ec.stack, cont->vm_stack, VALUE, sth->ec.stack_size); #endif + + /* other members of ec */ + th->ec.cfp = sth->ec.cfp; } else { /* fiber */ - th->ec.stack = sth->ec.stack; + th->ec = sth->ec; sth->ec.stack = NULL; - th->ec.stack_size = sth->ec.stack_size; + th->local_storage = sth->local_storage; th->local_storage_recursive_hash = sth->local_storage_recursive_hash; th->local_storage_recursive_hash_for_trace = sth->local_storage_recursive_hash_for_trace; + th->fiber = (rb_fiber_t*)cont; } - th->ec.cfp = sth->ec.cfp; th->safe_level = sth->safe_level; th->raised_flag = sth->raised_flag; - VM_ASSERT(sth->status == THREAD_RUNNABLE); th->tag = sth->tag; th->protect_tag = sth->protect_tag; th->errinfo = sth->errinfo; @@ -568,6 +570,8 @@ cont_restore_thread(rb_context_t *cont) https://github.com/ruby/ruby/blob/trunk/cont.c#L570 th->root_lep = sth->root_lep; th->root_svar = sth->root_svar; th->ensure_list = sth->ensure_list; + + VM_ASSERT(sth->status == THREAD_RUNNABLE); } #if FIBER_USE_NATIVE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/