… | |
… | |
453 | |
453 | |
454 | #define VAR(name,type) PL_ ## name = slot->name; |
454 | #define VAR(name,type) PL_ ## name = slot->name; |
455 | # include "state.h" |
455 | # include "state.h" |
456 | #undef VAR |
456 | #undef VAR |
457 | |
457 | |
|
|
458 | /*hv_store (hv_sig, strpair ("__DIE__" ), SvREFCNT_inc (sv_diehook ), 0);*/ |
|
|
459 | /*hv_store (hv_sig, strpair ("__WARN__"), SvREFCNT_inc (sv_warnhook), 0);*/ |
|
|
460 | |
458 | { |
461 | { |
459 | dSP; |
462 | dSP; |
460 | |
463 | |
461 | CV *cv; |
464 | CV *cv; |
462 | |
465 | |
… | |
… | |
521 | |
524 | |
522 | PUTBACK; |
525 | PUTBACK; |
523 | } |
526 | } |
524 | |
527 | |
525 | /* allocate some space on the context stack for our purposes */ |
528 | /* allocate some space on the context stack for our purposes */ |
|
|
529 | /* we manually unroll here, as usually 2 slots is enough */ |
|
|
530 | if (SLOT_COUNT >= 1) CXINC; |
|
|
531 | if (SLOT_COUNT >= 2) CXINC; |
|
|
532 | if (SLOT_COUNT >= 3) CXINC; |
526 | { |
533 | { |
527 | /* we manually unroll here, as usually 2 slots is enough */ |
|
|
528 | int i; |
534 | int i; |
529 | if (SLOT_COUNT >= 1) CXINC; |
|
|
530 | if (SLOT_COUNT >= 2) CXINC; |
|
|
531 | if (SLOT_COUNT >= 3) CXINC; |
|
|
532 | for (i = 3; i < SLOT_COUNT; ++i) |
535 | for (i = 3; i < SLOT_COUNT; ++i) |
533 | CXINC; |
536 | CXINC; |
534 | |
|
|
535 | cxstack_ix -= SLOT_COUNT; /* undo allocation */ |
|
|
536 | } |
537 | } |
|
|
538 | cxstack_ix -= SLOT_COUNT; /* undo allocation */ |
537 | |
539 | |
538 | c->mainstack = PL_mainstack; |
540 | c->mainstack = PL_mainstack; |
539 | |
541 | |
540 | { |
542 | { |
541 | perl_slots *slot = c->slot = (perl_slots *)(cxstack + cxstack_ix + 1); |
543 | perl_slots *slot = c->slot = (perl_slots *)(cxstack + cxstack_ix + 1); |
… | |
… | |
555 | * allocate various perl stacks. This is an exact copy |
557 | * allocate various perl stacks. This is an exact copy |
556 | * of perl.c:init_stacks, except that it uses less memory |
558 | * of perl.c:init_stacks, except that it uses less memory |
557 | * on the (sometimes correct) assumption that coroutines do |
559 | * on the (sometimes correct) assumption that coroutines do |
558 | * not usually need a lot of stackspace. |
560 | * not usually need a lot of stackspace. |
559 | */ |
561 | */ |
560 | #if CORO_PREFER_PERL_FUNCTIONS |
562 | #if 1 |
561 | # define coro_init_stacks init_stacks |
563 | # define coro_init_stacks init_stacks |
562 | #else |
564 | #else |
563 | static void |
565 | static void |
564 | coro_init_stacks (pTHX) |
566 | coro_init_stacks (pTHX) |
565 | { |
567 | { |
… | |
… | |
685 | PL_curpm = 0; |
687 | PL_curpm = 0; |
686 | PL_curpad = 0; |
688 | PL_curpad = 0; |
687 | PL_localizing = 0; |
689 | PL_localizing = 0; |
688 | PL_dirty = 0; |
690 | PL_dirty = 0; |
689 | PL_restartop = 0; |
691 | PL_restartop = 0; |
690 | SvREFCNT_inc (PL_diehook ); hv_store (hv_sig, strpair ("__DIE__" ), SvREFCNT_inc (sv_diehook ), 0); |
692 | PL_diehook = 0; hv_store (hv_sig, strpair ("__DIE__" ), SvREFCNT_inc (sv_diehook ), 0); |
691 | SvREFCNT_inc (PL_warnhook); hv_store (hv_sig, strpair ("__WARN__"), SvREFCNT_inc (sv_warnhook), 0); |
693 | PL_warnhook = 0; hv_store (hv_sig, strpair ("__WARN__"), SvREFCNT_inc (sv_warnhook), 0); |
692 | |
694 | |
693 | GvSV (PL_defgv) = newSV (0); |
695 | GvSV (PL_defgv) = newSV (0); |
694 | GvAV (PL_defgv) = coro->args; coro->args = 0; |
696 | GvAV (PL_defgv) = coro->args; coro->args = 0; |
695 | GvSV (PL_errgv) = newSV (0); |
697 | GvSV (PL_errgv) = newSV (0); |
696 | GvSV (irsgv) = newSVpvn ("\n", 1); sv_magic (GvSV (irsgv), (SV *)irsgv, PERL_MAGIC_sv, "/", 0); |
698 | GvSV (irsgv) = newSVpvn ("\n", 1); sv_magic (GvSV (irsgv), (SV *)irsgv, PERL_MAGIC_sv, "/", 0); |