1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

avoid false positive on fiber_verify().

* cont.c (fiber_store): move `cont_save_machine_stack()` timing to
  avoid `fiber_verify()` false positive on `FIBER_USE_NATIVE == 0`
  and `GC.stress = true`.
  This patch is very dirty and it should be removed soon.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2017-09-10 18:37:55 +00:00
parent 525532ff43
commit 2a01ac897d

7
cont.c
View file

@ -1444,6 +1444,12 @@ fiber_store(rb_fiber_t *next_fib, rb_thread_t *th)
#endif
if (FIBER_RESUMED_P(fib)) fiber_status_set(fib, FIBER_SUSPENDED);
#if FIBER_USE_NATIVE == 0
/* should (re-)allocate stack are before fib->status change to pass fiber_verify() */
cont_save_machine_stack(th, &fib->cont);
#endif
fiber_status_set(next_fib, FIBER_RESUMED);
#if FIBER_USE_NATIVE
@ -1473,7 +1479,6 @@ fiber_store(rb_fiber_t *next_fib, rb_thread_t *th)
return fib->cont.value;
#else /* FIBER_USE_NATIVE */
cont_save_machine_stack(th, &fib->cont);
if (ruby_setjmp(fib->cont.jmpbuf)) {
/* restored */
fib = th->ec.fiber;