vm_insnhelper.h (BOP): ISO C forbids comma at end of enumerator
list.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_context_t (rb_fiber_t includes rb_context_t).
rb_fiber_t has double linked list of fibers in same threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RUBY_VM_SET_TIMER_INTERRUPT(), RUBY_VM_INTERRUPTED().
* thread.c, thread_pthread.c, thread_win32.c: fix to ignore time slice
event until sleep.
* bootstraptest/test_thread.rb: add a test for time limited join test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
suppress warnings.
* cont.c (rb_fiber_start): change on non-volatile variable between
setjmp and longjmp may not has an effect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
and Fiber::Core class to realize Coroutine.
* include/ruby/intern.h: declare rb_fiber_yield(), rb_fiber_resume(),
* enumerator.c: use above api.
* test/ruby/test_fiber.rb: fix and add tests for above changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c (rb_fiber_current): export
* include/ruby/intern.h: export several functions from cont.c.
* enumerator.c (enumerator_next): new method to implement external
iterator (generator) using fiber.
* enumerator.c (enumerator_next_p): new method to check whether
any element is left in the generator sequence.
* enumerator.c (enumerator_rewind): a new method to rewind the
generator sequence.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.h (SET_MACHINE_STACK_END): new macro to replace
rb_gc_set_stack_end. it find out accurate stack boundary by
asm using gcc on x86.
* thread.c (rb_gc_set_stack_end): don't define if asm-version
SET_MACHINE_STACK_END is available.
* gc.c (mark_current_thread): extracted from garbage_collect.
it use SET_MACHINE_STACK_END to not scan out of stack area.
it notify conservative GC information to valgrind if
--enable-valgrind.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* yarvcore.c (th_init2): ditto.
* vm.c, vm.h: fix to stop using Qundef on VM stack. According to
this change, VM stack should not include Qundef value.
* insns.def (putundef): removed.
* compile.c (iseq_compile_each): ditto.
* eval.c (eval): fix spacing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to avoid GC problem in very early stage.
(RUBY_GC_STRESS causes GC in such stage.)
* variable.c (rb_gc_mark_global_tbl): rb_global_tbl may be 0 in
very early stage.
* thread.c (thread_cleanup_func) [IA64]: clear register stack position.
(thread_start_func_2) [IA64]: record the beginning of register
stack using extra argument.
(rb_gc_save_machine_context) [IA64]: record the end of register
stack.
* gc.c [IA64] (SET_STACK_END): record the end of register stack.
(garbage_collect) [IA64]: use recorded register stack area for
GC marking.
(yarv_machine_stack_mark) [IA64]: GC mark from the register stack
area.
* yarvcore.c [IA64] (rb_gc_register_stack_start): defined.
(Init_VM): store th->self on stack to fix GC problem.
(Init_yarv) [IA64]: initialize the beginning of register stack.
* yarvcore.h (struct rb_thread_struct) [IA64]: new members for
register stack area.
* thread_pthread.ci (thread_start_func_1) [IA64]: call
thread_start_func_2 with the end of register stack.
* cont.c (struct rb_context_struct) [IA64]: new members for register
stack area.
(cont_mark) [IA64]: GC mark from register stack area.
(cont_free) [IA64]: free saved register stack.
(cont_save_machine_stack) [IA64]: record the position and contents
of the register stack.
(cont_capture): store cont->self on stack to fix GC problem.
(cont_restore_1) [IA64]: restore the register stack.
[IA64] (register_stack_extend): new function.
(cont_restore_0) [IA64]: call register_stack_extend instead of
cont_restore_1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c (cont_restore_1): copy stack information from fiber.
* cont.c (rb_fiber_s_new): fix to mark created fiber.
* test/ruby/test_fiber.rb: add some tests around Thread and Fiber.
* yarvcore.c (thread_free): fix to skip freeing stack if root fiber
is available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
of fiber body receive first yield values.
e.g.: Fiber.new{|x| p x}.yield(:ok) #=> :ok
* cont.c: rename rb_context_t#retval to rb_context_t#value.
* test/ruby/test_fiber.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Fiber is known as "Micro Thread", "Coroutine", and other terms.
At this time, only Fiber#pass is supported to change context.
I want to know more suitable method name/API for Fiber (... do you
know more suitable class name instead of Fiber?) as "suspend/resume",
"call", "yield", "start/kick/stop/restart", ....
* eval.c, eval_intern.h, thread.c, yarvcore.c, yarvcore.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e