ruby-changes:47669
From: normal <ko1@a...>
Date: Sat, 9 Sep 2017 08:51:19 +0900 (JST)
Subject: [ruby-changes:47669] normal:r59785 (trunk): fiber: fix machine stack marking when FIBER_USE_NATIVE is 0
normal 2017-09-09 08:51:14 +0900 (Sat, 09 Sep 2017) New Revision: 59785 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59785 Log: fiber: fix machine stack marking when FIBER_USE_NATIVE is 0 * cont.c (cont_mark): mark Fiber machine stack correctly when FIBER_USE_NATIVE is 0 * test/ruby/test_fiber.rb (test_mark_fiber): new test [Bug #13875] [ruby-core:82681] This bug appears to be introduced with r59557. ("refactoring Fiber status") Modified files: trunk/cont.c trunk/test/ruby/test_fiber.rb Index: test/ruby/test_fiber.rb =================================================================== --- test/ruby/test_fiber.rb (revision 59784) +++ test/ruby/test_fiber.rb (revision 59785) @@ -217,6 +217,17 @@ class TestFiber < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_fiber.rb#L217 }, bug4612 end + def test_mark_fiber + bug13875 = '[ruby-core:82681]' + + assert_normal_exit %q{ + GC.stress = true + up = 1.upto(10) + down = 10.downto(1) + up.zip(down) {|a, b| a + b == 11 or fail 'oops'} + }, bug13875 + end + def test_no_valid_cfp bug5083 = '[ruby-dev:44208]' assert_equal([], Fiber.new(&Module.method(:nesting)).resume, bug5083) Index: cont.c =================================================================== --- cont.c (revision 59784) +++ cont.c (revision 59785) @@ -248,7 +248,7 @@ cont_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/cont.c#L248 const rb_thread_t *th = rb_thread_ptr(cont->saved_thread.self); const rb_fiber_t *fib = (rb_fiber_t*)cont; - if ((th->ec.fiber != fib) && FIBER_SUSPENDED_P(fib)) { + if ((th->ec.fiber != fib) && !FIBER_TERMINATED_P(fib)) { rb_gc_mark_locations(cont->machine.stack, cont->machine.stack + cont->machine.stack_size); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/