… | |
… | |
692 | { |
692 | { |
693 | stack_put (prev_stack); |
693 | stack_put (prev_stack); |
694 | prev->stack = 0; |
694 | prev->stack = 0; |
695 | } |
695 | } |
696 | |
696 | |
697 | if (!next->mainstack) |
697 | if (next->mainstack) |
698 | { |
698 | { |
|
|
699 | /* coroutine already started */ |
|
|
700 | SAVE (prev, flags); |
|
|
701 | LOAD (next); |
|
|
702 | } |
|
|
703 | else |
|
|
704 | { |
|
|
705 | /* need to start coroutine */ |
699 | /* first get rid of the old state */ |
706 | /* first get rid of the old state */ |
700 | SAVE (prev, -1); |
707 | SAVE (prev, -1); |
701 | /* setup coroutine call */ |
708 | /* setup coroutine call */ |
702 | setup_coro (next); |
709 | setup_coro (next); |
|
|
710 | /* need to change stack from main_stack to real one */ |
703 | next->stack = 0; |
711 | next->stack = 0; |
704 | } |
|
|
705 | else |
|
|
706 | { |
|
|
707 | SAVE (prev, flags); |
|
|
708 | LOAD (next); |
|
|
709 | } |
712 | } |
710 | |
713 | |
711 | if (!next->stack) |
714 | if (!next->stack) |
712 | stack_get (next); |
715 | stack_get (next); |
713 | |
716 | |