void rb_fiber_start(void) { rb_thread_t *th = GET_THREAD(); rb_fiber_t *fib; rb_context_t *cont; rb_proc_t *proc; int state; GetFiberPtr(th->fiber, fib); cont = &fib->cont; TH_PUSH_TAG(th); if ((state = EXEC_TAG()) == 0) { int argc; VALUE *argv, args; GetProcPtr(cont->saved_thread.first_proc, proc); args = cont->value; argv = (argc = cont->argc) > 1 ? RARRAY_PTR(args) : &args; cont->value = Qnil; th->errinfo = Qnil; th->local_lfp = proc->block.lfp; th->local_svar = Qnil; fib->status = RUNNING; cont->value = rb_vm_invoke_proc(th, proc, proc->block.self, argc, argv, 0); } TH_POP_TAG(); if (state) { if (TAG_RAISE) { th->thrown_errinfo = th->errinfo; } else { th->thrown_errinfo = rb_vm_make_jump_tag_but_local_jump(state, th->errinfo); } RUBY_VM_SET_INTERRUPT(th); } rb_fiber_terminate(fib); rb_bug("rb_fiber_start: unreachable"); }
void rb_fiber_start(void) { rb_thread_t *th = GET_THREAD(); rb_context_t *cont; rb_proc_t *proc; VALUE args; int state; GetContPtr(th->fiber, cont); TH_PUSH_TAG(th); if ((state = EXEC_TAG()) == 0) { GetProcPtr(cont->saved_thread.first_proc, proc); args = cont->value; cont->value = Qnil; th->errinfo = Qnil; th->local_lfp = proc->block.lfp; th->local_svar = Qnil; cont->value = vm_invoke_proc(th, proc, proc->block.self, 1, &args, 0); } TH_POP_TAG(); if (state) { if (TAG_RAISE) { th->thrown_errinfo = th->errinfo; } else { th->thrown_errinfo = vm_make_jump_tag_but_local_jump(state, th->errinfo); } RUBY_VM_SET_INTERRUPT(th); } rb_fiber_terminate(cont); rb_bug("rb_fiber_start: unreachable"); }