… | |
… | |
68 | AV *curstack; |
68 | AV *curstack; |
69 | AV *mainstack; |
69 | AV *mainstack; |
70 | SV **stack_sp; |
70 | SV **stack_sp; |
71 | OP *op; |
71 | OP *op; |
72 | SV **curpad; |
72 | SV **curpad; |
|
|
73 | AV *comppad; |
73 | SV **stack_base; |
74 | SV **stack_base; |
74 | SV **stack_max; |
75 | SV **stack_max; |
75 | SV **tmps_stack; |
76 | SV **tmps_stack; |
76 | I32 tmps_floor; |
77 | I32 tmps_floor; |
77 | I32 tmps_ix; |
78 | I32 tmps_ix; |
… | |
… | |
87 | I32 savestack_max; |
88 | I32 savestack_max; |
88 | OP **retstack; |
89 | OP **retstack; |
89 | I32 retstack_ix; |
90 | I32 retstack_ix; |
90 | I32 retstack_max; |
91 | I32 retstack_max; |
91 | COP *curcop; |
92 | COP *curcop; |
92 | PMOP *curpm; |
|
|
93 | JMPENV *top_env; |
93 | JMPENV *top_env; |
94 | |
94 | |
95 | /* data associated with this coroutine (initial args) */ |
95 | /* data associated with this coroutine (initial args) */ |
96 | AV *args; |
96 | AV *args; |
97 | }; |
97 | }; |
… | |
… | |
291 | PL_curstack = c->curstack; |
291 | PL_curstack = c->curstack; |
292 | PL_mainstack = c->mainstack; |
292 | PL_mainstack = c->mainstack; |
293 | PL_stack_sp = c->stack_sp; |
293 | PL_stack_sp = c->stack_sp; |
294 | PL_op = c->op; |
294 | PL_op = c->op; |
295 | PL_curpad = c->curpad; |
295 | PL_curpad = c->curpad; |
|
|
296 | PL_comppad = c->comppad; |
296 | PL_stack_base = c->stack_base; |
297 | PL_stack_base = c->stack_base; |
297 | PL_stack_max = c->stack_max; |
298 | PL_stack_max = c->stack_max; |
298 | PL_tmps_stack = c->tmps_stack; |
299 | PL_tmps_stack = c->tmps_stack; |
299 | PL_tmps_floor = c->tmps_floor; |
300 | PL_tmps_floor = c->tmps_floor; |
300 | PL_tmps_ix = c->tmps_ix; |
301 | PL_tmps_ix = c->tmps_ix; |
… | |
… | |
420 | c->curstack = PL_curstack; |
421 | c->curstack = PL_curstack; |
421 | c->mainstack = PL_mainstack; |
422 | c->mainstack = PL_mainstack; |
422 | c->stack_sp = PL_stack_sp; |
423 | c->stack_sp = PL_stack_sp; |
423 | c->op = PL_op; |
424 | c->op = PL_op; |
424 | c->curpad = PL_curpad; |
425 | c->curpad = PL_curpad; |
|
|
426 | c->comppad = PL_comppad; |
425 | c->stack_base = PL_stack_base; |
427 | c->stack_base = PL_stack_base; |
426 | c->stack_max = PL_stack_max; |
428 | c->stack_max = PL_stack_max; |
427 | c->tmps_stack = PL_tmps_stack; |
429 | c->tmps_stack = PL_tmps_stack; |
428 | c->tmps_floor = PL_tmps_floor; |
430 | c->tmps_floor = PL_tmps_floor; |
429 | c->tmps_ix = PL_tmps_ix; |
431 | c->tmps_ix = PL_tmps_ix; |
… | |
… | |
598 | dSP; |
600 | dSP; |
599 | Coro__State ctx = (Coro__State)arg; |
601 | Coro__State ctx = (Coro__State)arg; |
600 | SV *sub_init = (SV*)get_cv(SUB_INIT, FALSE); |
602 | SV *sub_init = (SV*)get_cv(SUB_INIT, FALSE); |
601 | |
603 | |
602 | coro_init_stacks (aTHX); |
604 | coro_init_stacks (aTHX); |
603 | PL_curpm = 0; /* segfault on first access */ |
|
|
604 | /*PL_curcop = 0;*/ |
605 | /*PL_curcop = 0;*/ |
605 | /*PL_in_eval = PL_in_eval;*/ /* inherit */ |
606 | /*PL_in_eval = PL_in_eval;*/ /* inherit */ |
606 | SvREFCNT_dec (GvAV (PL_defgv)); |
607 | SvREFCNT_dec (GvAV (PL_defgv)); |
607 | GvAV (PL_defgv) = ctx->args; |
608 | GvAV (PL_defgv) = ctx->args; |
608 | |
609 | |
… | |
… | |
639 | * that doesn't matter, though, since it is only |
640 | * that doesn't matter, though, since it is only |
640 | * pp_nextstate and we never return... |
641 | * pp_nextstate and we never return... |
641 | * ah yes, and I don't care anyways ;) |
642 | * ah yes, and I don't care anyways ;) |
642 | */ |
643 | */ |
643 | PUTBACK; |
644 | PUTBACK; |
644 | PL_op = pp_entersub(); |
645 | PL_op = PL_ppaddr[OP_ENTERSUB](aTHX); |
645 | SPAGAIN; |
646 | SPAGAIN; |
646 | |
647 | |
647 | ENTER; /* necessary e.g. for dounwind */ |
648 | ENTER; /* necessary e.g. for dounwind */ |
648 | } |
649 | } |
649 | } |
650 | } |
… | |
… | |
750 | setup_coro (next); |
751 | setup_coro (next); |
751 | } |
752 | } |
752 | |
753 | |
753 | /* |
754 | /* |
754 | * xnext is now either prev or next, depending on wether |
755 | * xnext is now either prev or next, depending on wether |
755 | * we switched the c stack or not. that's why i use a global |
756 | * we switched the c stack or not. that's why I use a global |
756 | * variable, that should become thread-specific at one point. |
757 | * variable, that should become thread-specific at one point. |
757 | */ |
758 | */ |
758 | xnext->cursp = stacklevel; |
759 | xnext->cursp = stacklevel; |
759 | } |
760 | } |
760 | |
761 | |
… | |
… | |
902 | coro_state_stash = gv_stashpv ("Coro::State", TRUE); |
903 | coro_state_stash = gv_stashpv ("Coro::State", TRUE); |
903 | |
904 | |
904 | newCONSTSUB (coro_state_stash, "SAVE_DEFAV", newSViv (TRANSFER_SAVE_DEFAV)); |
905 | newCONSTSUB (coro_state_stash, "SAVE_DEFAV", newSViv (TRANSFER_SAVE_DEFAV)); |
905 | newCONSTSUB (coro_state_stash, "SAVE_DEFSV", newSViv (TRANSFER_SAVE_DEFSV)); |
906 | newCONSTSUB (coro_state_stash, "SAVE_DEFSV", newSViv (TRANSFER_SAVE_DEFSV)); |
906 | newCONSTSUB (coro_state_stash, "SAVE_ERRSV", newSViv (TRANSFER_SAVE_ERRSV)); |
907 | newCONSTSUB (coro_state_stash, "SAVE_ERRSV", newSViv (TRANSFER_SAVE_ERRSV)); |
907 | newCONSTSUB (coro_state_stash, "SAVE_CURPM", newSViv (TRANSFER_SAVE_CURPM)); |
|
|
908 | newCONSTSUB (coro_state_stash, "SAVE_CCTXT", newSViv (TRANSFER_SAVE_CCTXT)); |
908 | newCONSTSUB (coro_state_stash, "SAVE_CCTXT", newSViv (TRANSFER_SAVE_CCTXT)); |
909 | |
909 | |
910 | if (!padlist_cache) |
910 | if (!padlist_cache) |
911 | padlist_cache = newHV (); |
911 | padlist_cache = newHV (); |
912 | |
912 | |