summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-10 18:37:55 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-10 18:37:55 +0000
commit2a01ac897d98e1794666782ece6673185613171a (patch)
tree73ed6dda8168d6290817afd39b66cd50ba19616f
parent525532ff43a6c3ce4195ce4a21f4b7cb589d32a6 (diff)
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
-rw-r--r--cont.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cont.c b/cont.c
index dd15c30..2068bcd 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;