From 2a01ac897d98e1794666782ece6673185613171a Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 10 Sep 2017 18:37:55 +0000 Subject: 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 --- cont.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cont.c') diff --git a/cont.c b/cont.c index dd15c30a4c..2068bcd51a 100644 --- a/cont.c +++ b/cont.c @@ -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; -- cgit v1.2.3