ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/State.xs
(Generate patch)

Comparing Coro/Coro/State.xs (file contents):
Revision 1.11 by root, Sat Jul 21 18:21:45 2001 UTC vs.
Revision 1.19 by root, Sun Jul 29 01:11:41 2001 UTC

1#include "EXTERN.h" 1#include "EXTERN.h"
2#include "perl.h" 2#include "perl.h"
3#include "XSUB.h" 3#include "XSUB.h"
4 4
5#if 1 5#include "libcoro/coro.c"
6# define CHK(x) (void *)0 6
7#ifdef HAVE_MMAP
8# include <unistd.h>
9# include <sys/mman.h>
10# ifndef MAP_ANON
11# ifdef MAP_ANONYMOUS
12# define MAP_ANON MAP_ANONYMOUS
13# else
14# undef HAVE_MMAP
15# endif
16# endif
17#endif
18
19#define MAY_FLUSH /* increases codesize */
20
21/* perl-related */
22#define TRANSFER_SAVE_DEFAV 0x00000001
23#define TRANSFER_SAVE_DEFSV 0x00000002
24#define TRANSFER_SAVE_ERRSV 0x00000004
25/* c-related */
26#define TRANSFER_SAVE_CCTXT 0x00000008
27#ifdef CORO_LAZY_STACK
28# define TRANSFER_LAZY_STACK 0x00000010
7#else 29#else
8# define CHK(x) if (!(x)) croak("FATAL, CHK: " #x) 30# define TRANSFER_LAZY_STACK 0x00000000
9#endif 31#endif
10 32
11#define MAY_FLUSH /* increases codesize */ 33#define TRANSFER_SAVE_ALL (TRANSFER_SAVE_DEFAV|TRANSFER_SAVE_DEFSV \
34 |TRANSFER_SAVE_ERRSV|TRANSFER_SAVE_CCTXT)
12 35
13#define SUB_INIT "Coro::State::initialize" 36#define SUB_INIT "Coro::State::initialize"
37#define UCORO_STATE "_coro_state"
14 38
15#define SAVE_DEFAV 0x00000001 39/* The next macro should delcare a variable stacklevel that contains and approximation
16#define SAVE_DEFSV 0x00000002 40 * to the current C stack pointer. It's property is that it changes with each call
17#define SAVE_ERRSV 0x00000004 41 * and should be unique. */
42#define dSTACKLEVEL void *stacklevel = &stacklevel
18 43
19#define SAVE_ALL -1 44#define labs(l) ((l) >= 0 ? (l) : -(l))
45
46/* this is actually not only the c stack but also c registers etc... */
47typedef struct {
48 int refcnt; /* pointer reference counter */
49 int usecnt; /* shared by how many coroutines */
50 int gencnt; /* generation counter */
51
52 coro_context cctx;
53
54 void *sptr;
55 long ssize; /* positive == mmap, otherwise malloc */
56} coro_stack;
20 57
21struct coro { 58struct coro {
59 /* the optional C context */
60 coro_stack *stack;
61 void *cursp;
62 int gencnt;
63
22 /* optionally saved, might be zero */ 64 /* optionally saved, might be zero */
23 AV *defav; 65 AV *defav;
24 SV *defsv; 66 SV *defsv;
25 SV *errsv; 67 SV *errsv;
26 68
27 /* saved global state not related to stacks */ 69 /* saved global state not related to stacks */
28 U8 dowarn; 70 U8 dowarn;
71 I32 in_eval;
29 72
30 /* the stacks and related info (callchain etc..) */ 73 /* the stacks and related info (callchain etc..) */
31 PERL_SI *curstackinfo; 74 PERL_SI *curstackinfo;
32 AV *curstack; 75 AV *curstack;
33 AV *mainstack; 76 AV *mainstack;
51 I32 savestack_max; 94 I32 savestack_max;
52 OP **retstack; 95 OP **retstack;
53 I32 retstack_ix; 96 I32 retstack_ix;
54 I32 retstack_max; 97 I32 retstack_max;
55 COP *curcop; 98 COP *curcop;
99 JMPENV *top_env;
56 100
57 /* data associated with this coroutine (initial args) */ 101 /* data associated with this coroutine (initial args) */
58 AV *args; 102 AV *args;
59}; 103};
60 104
61typedef struct coro *Coro__State; 105typedef struct coro *Coro__State;
62typedef struct coro *Coro__State_or_hashref; 106typedef struct coro *Coro__State_or_hashref;
63 107
108static AV *main_mainstack; /* used to differentiate between $main and others */
109static HV *coro_state_stash;
110static SV *ucoro_state_sv;
111static U32 ucoro_state_hash;
64static HV *padlist_cache; 112static HV *padlist_cache;
65 113
66/* mostly copied from op.c:cv_clone2 */ 114/* mostly copied from op.c:cv_clone2 */
67STATIC AV * 115STATIC AV *
68clone_padlist (AV *protopadlist) 116clone_padlist (AV *protopadlist)
231#endif 279#endif
232 280
233#define SB do { 281#define SB do {
234#define SE } while (0) 282#define SE } while (0)
235 283
236#define LOAD(state) SB load_state(aTHX_ state); SPAGAIN; SE 284#define LOAD(state) SB load_state(aTHX_ (state)); SPAGAIN; SE
237#define SAVE(state,flags) SB PUTBACK; save_state(aTHX_ state,flags); SE 285#define SAVE(state,flags) SB PUTBACK; save_state(aTHX_ (state),(flags)); SE
238 286
239#define REPLACE_SV(sv,val) SB SvREFCNT_dec(sv); (sv) = (val); SE 287#define REPLACE_SV(sv,val) SB SvREFCNT_dec(sv); (sv) = (val); SE
240 288
241static void 289static void
242load_state(pTHX_ Coro__State c) 290load_state(pTHX_ Coro__State c)
243{ 291{
244 PL_dowarn = c->dowarn; 292 PL_dowarn = c->dowarn;
293 PL_in_eval = c->in_eval;
245 294
246 PL_curstackinfo = c->curstackinfo; 295 PL_curstackinfo = c->curstackinfo;
247 PL_curstack = c->curstack; 296 PL_curstack = c->curstack;
248 PL_mainstack = c->mainstack; 297 PL_mainstack = c->mainstack;
249 PL_stack_sp = c->stack_sp; 298 PL_stack_sp = c->stack_sp;
266 PL_savestack_max = c->savestack_max; 315 PL_savestack_max = c->savestack_max;
267 PL_retstack = c->retstack; 316 PL_retstack = c->retstack;
268 PL_retstack_ix = c->retstack_ix; 317 PL_retstack_ix = c->retstack_ix;
269 PL_retstack_max = c->retstack_max; 318 PL_retstack_max = c->retstack_max;
270 PL_curcop = c->curcop; 319 PL_curcop = c->curcop;
320 PL_top_env = c->top_env;
271 321
272 if (c->defav) REPLACE_SV (GvAV (PL_defgv), c->defav); 322 if (c->defav) REPLACE_SV (GvAV (PL_defgv), c->defav);
273 if (c->defsv) REPLACE_SV (DEFSV , c->defsv); 323 if (c->defsv) REPLACE_SV (DEFSV , c->defsv);
274 if (c->errsv) REPLACE_SV (ERRSV , c->errsv); 324 if (c->errsv) REPLACE_SV (ERRSV , c->errsv);
275 325
363 } 413 }
364 414
365 PUTBACK; 415 PUTBACK;
366 } 416 }
367 417
368 c->defav = flags & SAVE_DEFAV ? (AV *)SvREFCNT_inc (GvAV (PL_defgv)) : 0; 418 c->defav = flags & TRANSFER_SAVE_DEFAV ? (AV *)SvREFCNT_inc (GvAV (PL_defgv)) : 0;
369 c->defsv = flags & SAVE_DEFSV ? SvREFCNT_inc (DEFSV) : 0; 419 c->defsv = flags & TRANSFER_SAVE_DEFSV ? SvREFCNT_inc (DEFSV) : 0;
370 c->errsv = flags & SAVE_ERRSV ? SvREFCNT_inc (ERRSV) : 0; 420 c->errsv = flags & TRANSFER_SAVE_ERRSV ? SvREFCNT_inc (ERRSV) : 0;
371 421
372 /* I have not the slightest idea of why av_reify is necessary */ 422 /* I have not the slightest idea of why av_reify is necessary */
373 /* but if it's missing the defav contents magically get replaced sometimes */ 423 /* but if it's missing the defav contents magically get replaced sometimes */
374 if (c->defav) 424 if (c->defav)
375 av_reify (c->defav); 425 av_reify (c->defav);
376 426
377 c->dowarn = PL_dowarn; 427 c->dowarn = PL_dowarn;
428 c->in_eval = PL_in_eval;
378 429
379 c->curstackinfo = PL_curstackinfo; 430 c->curstackinfo = PL_curstackinfo;
380 c->curstack = PL_curstack; 431 c->curstack = PL_curstack;
381 c->mainstack = PL_mainstack; 432 c->mainstack = PL_mainstack;
382 c->stack_sp = PL_stack_sp; 433 c->stack_sp = PL_stack_sp;
399 c->savestack_max = PL_savestack_max; 450 c->savestack_max = PL_savestack_max;
400 c->retstack = PL_retstack; 451 c->retstack = PL_retstack;
401 c->retstack_ix = PL_retstack_ix; 452 c->retstack_ix = PL_retstack_ix;
402 c->retstack_max = PL_retstack_max; 453 c->retstack_max = PL_retstack_max;
403 c->curcop = PL_curcop; 454 c->curcop = PL_curcop;
455 c->top_env = PL_top_env;
456}
457
458/*
459 * allocate various perl stacks. This is an exact copy
460 * of perl.c:init_stacks, except that it uses less memory
461 * on the assumption that coroutines do not usually need
462 * a lot of stackspace.
463 */
464STATIC void
465coro_init_stacks (pTHX)
466{
467 PL_curstackinfo = new_stackinfo(96, 1024/sizeof(PERL_CONTEXT) - 1);
468 PL_curstackinfo->si_type = PERLSI_MAIN;
469 PL_curstack = PL_curstackinfo->si_stack;
470 PL_mainstack = PL_curstack; /* remember in case we switch stacks */
471
472 PL_stack_base = AvARRAY(PL_curstack);
473 PL_stack_sp = PL_stack_base;
474 PL_stack_max = PL_stack_base + AvMAX(PL_curstack);
475
476 New(50,PL_tmps_stack,96,SV*);
477 PL_tmps_floor = -1;
478 PL_tmps_ix = -1;
479 PL_tmps_max = 96;
480
481 New(54,PL_markstack,16,I32);
482 PL_markstack_ptr = PL_markstack;
483 PL_markstack_max = PL_markstack + 16;
484
485 SET_MARK_OFFSET;
486
487 New(54,PL_scopestack,16,I32);
488 PL_scopestack_ix = 0;
489 PL_scopestack_max = 16;
490
491 New(54,PL_savestack,96,ANY);
492 PL_savestack_ix = 0;
493 PL_savestack_max = 96;
494
495 New(54,PL_retstack,8,OP*);
496 PL_retstack_ix = 0;
497 PL_retstack_max = 8;
404} 498}
405 499
406/* 500/*
407 * destroy the stacks, the callchain etc... 501 * destroy the stacks, the callchain etc...
408 * still there is a memleak of 128 bytes... 502 * still there is a memleak of 128 bytes...
444 Safefree(PL_scopestack); 538 Safefree(PL_scopestack);
445 Safefree(PL_savestack); 539 Safefree(PL_savestack);
446 Safefree(PL_retstack); 540 Safefree(PL_retstack);
447} 541}
448 542
543static void
544allocate_stack (Coro__State ctx, int alloc)
545{
546 coro_stack *stack;
547
548 New (0, stack, 1, coro_stack);
549
550 stack->refcnt = 1;
551 stack->usecnt = 1;
552 stack->gencnt = ctx->gencnt = 0;
553 if (alloc)
554 {
555#ifdef HAVE_MMAP
556 stack->ssize = 128 * 1024 * sizeof (long); /* mmap should do allocate-on-write for us */
557 stack->sptr = mmap (0, stack->ssize, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 0, 0);
558 if (stack->sptr == (void *)-1)
559#endif
560 {
561 /*FIXME*//*D*//* reasonable stack size! */
562 stack->ssize = -4096 * sizeof (long);
563 New (0, stack->sptr, 4096, long);
564 }
565 }
566 else
567 stack->sptr = 0;
568
569 ctx->stack = stack;
570}
571
572static void
573deallocate_stack (Coro__State ctx)
574{
575 coro_stack *stack = ctx->stack;
576
577 ctx->stack = 0;
578
579 if (stack)
580 {
581 if (!--stack->refcnt)
582 {
583#ifdef HAVE_MMAP
584 if (stack->ssize > 0 && stack->sptr)
585 munmap (stack->sptr, stack->ssize);
586 else
587#else
588 Safefree (stack->sptr);
589#endif
590 Safefree (stack);
591 }
592 else if (ctx->gencnt == stack->gencnt)
593 --stack->usecnt;
594 }
595}
596
597static void
598setup_coro (void *arg)
599{
600 /*
601 * emulate part of the perl startup here.
602 */
603 dSP;
604 Coro__State ctx = (Coro__State)arg;
605 SV *sub_init = (SV*)get_cv(SUB_INIT, FALSE);
606
607 coro_init_stacks (aTHX);
608 /*PL_curcop = 0;*/
609 /*PL_in_eval = PL_in_eval;*/ /* inherit */
610 SvREFCNT_dec (GvAV (PL_defgv));
611 GvAV (PL_defgv) = ctx->args;
612
613 SPAGAIN;
614
615 if (ctx->stack)
616 {
617 ctx->cursp = 0;
618
619 PUSHMARK(SP);
620 PUTBACK;
621 (void) call_sv (sub_init, G_VOID|G_NOARGS|G_EVAL);
622
623 if (SvTRUE (ERRSV))
624 croak (NULL);
625 else
626 croak ("FATAL: CCTXT coroutine returned!");
627 }
628 else
629 {
630 UNOP myop;
631
632 PL_op = (OP *)&myop;
633
634 Zero(&myop, 1, UNOP);
635 myop.op_next = Nullop;
636 myop.op_flags = OPf_WANT_VOID;
637
638 PUSHMARK(SP);
639 XPUSHs (sub_init);
640 /*
641 * the next line is slightly wrong, as PL_op->op_next
642 * is actually being executed so we skip the first op.
643 * that doesn't matter, though, since it is only
644 * pp_nextstate and we never return...
645 * ah yes, and I don't care anyways ;)
646 */
647 PUTBACK;
648 PL_op = pp_entersub();
649 SPAGAIN;
650
651 ENTER; /* necessary e.g. for dounwind */
652 }
653}
654
655static void
656continue_coro (void *arg)
657{
658 /*
659 * this is a _very_ stripped down perl interpreter ;)
660 */
661 Coro__State ctx = (Coro__State)arg;
662
663 /*FIXME*//* must set up top_env here */
664 ctx->cursp = 0;
665 PL_op = PL_op->op_next;
666 CALLRUNOPS(aTHX);
667
668 abort ();
669}
670
449STATIC void 671STATIC void
450transfer(pTHX_ struct coro *prev, struct coro *next, int flags) 672transfer(pTHX_ struct coro *prev, struct coro *next, int flags)
451{ 673{
452 dSP; 674 dSP;
675 dSTACKLEVEL;
453 676
454 if (prev != next) 677 if (prev != next)
455 { 678 {
456 /*
457 * this could be done in newprocess which would lead to
458 * extremely elegant and fast (just SAVE/LOAD)
459 * code here, but lazy allocation of stacks has also
460 * some virtues and the overhead of the if() is nil.
461 */
462 if (next->mainstack) 679 if (next->mainstack)
463 { 680 {
464 SAVE (prev, flags); 681 SAVE (prev, flags);
465 LOAD (next); 682 LOAD (next);
683
466 /* mark this state as in-use */ 684 /* mark this state as in-use */
467 next->mainstack = 0; 685 next->mainstack = 0;
468 next->tmps_ix = -2; 686 next->tmps_ix = -2;
687
688 /* stacklevel changed? if yes, grab the stack for us! */
689 if (flags & TRANSFER_SAVE_CCTXT)
690 {
691 if (!prev->stack)
692 allocate_stack (prev, 0);
693 else if (prev->cursp != stacklevel
694 && prev->stack->usecnt > 1)
695 {
696 prev->gencnt = ++prev->stack->gencnt;
697 prev->stack->usecnt = 1;
698 }
699
700 /* has our stack been invalidated? */
701 if (next->stack && next->stack->gencnt != next->gencnt)
702 {
703 deallocate_stack (next);
704 allocate_stack (next, 1);
705 coro_create (&(next->stack->cctx),
706 continue_coro, (void *)next,
707 next->stack->sptr, labs (next->stack->ssize));
708 }
709
710 coro_transfer (&(prev->stack->cctx), &(next->stack->cctx));
711 }
712
469 } 713 }
470 else if (next->tmps_ix == -2) 714 else if (next->tmps_ix == -2)
471 {
472 croak ("tried to transfer to running coroutine"); 715 croak ("tried to transfer to running coroutine");
473 }
474 else 716 else
475 { 717 {
476 /*
477 * emulate part of the perl startup here.
478 */
479 UNOP myop;
480
481 SAVE (prev, -1); /* first get rid of the old state */ 718 SAVE (prev, -1); /* first get rid of the old state */
482 719
483 init_stacks (); /* from perl.c */ 720 if (flags & TRANSFER_SAVE_CCTXT)
484 SPAGAIN;
485
486 PL_op = (OP *)&myop;
487 /*PL_curcop = 0;*/
488 SvREFCNT_dec (GvAV (PL_defgv));
489 GvAV (PL_defgv) = next->args;
490
491 Zero(&myop, 1, UNOP);
492 myop.op_next = Nullop;
493 myop.op_flags = OPf_WANT_VOID;
494
495 PUSHMARK(SP);
496 XPUSHs ((SV*)get_cv(SUB_INIT, TRUE));
497 /*
498 * the next line is slightly wrong, as PL_op->op_next
499 * is actually being executed so we skip the first op.
500 * that doesn't matter, though, since it is only
501 * pp_nextstate and we never return...
502 * ah yes, and I don't care anyways ;)
503 */ 721 {
504 PUTBACK; 722 if (!prev->stack)
505 PL_op = pp_entersub(aTHX); 723 allocate_stack (prev, 0);
506 SPAGAIN;
507 724
508 ENTER; /* necessary e.g. for dounwind */ 725 if (prev->stack->sptr && flags & TRANSFER_LAZY_STACK)
726 {
727 setup_coro (next);
728
729 prev->stack->refcnt++;
730 prev->stack->usecnt++;
731 next->stack = prev->stack;
732 next->gencnt = prev->gencnt;
733 }
734 else
735 {
736 allocate_stack (next, 1);
737 coro_create (&(next->stack->cctx),
738 setup_coro, (void *)next,
739 next->stack->sptr, labs (next->stack->ssize));
740 coro_transfer (&(prev->stack->cctx), &(next->stack->cctx));
741 }
742 }
743 else
744 setup_coro (next);
509 } 745 }
510 } 746 }
747
748 next->cursp = stacklevel;
511} 749}
512 750
513MODULE = Coro::State PACKAGE = Coro::State 751MODULE = Coro::State PACKAGE = Coro::State
514 752
515PROTOTYPES: ENABLE 753PROTOTYPES: ENABLE
516 754
517BOOT: 755BOOT:
518{ /* {} necessary for stoopid perl-5.6.x */ 756{ /* {} necessary for stoopid perl-5.6.x */
757 ucoro_state_sv = newSVpv (UCORO_STATE, sizeof(UCORO_STATE) - 1);
758 PERL_HASH(ucoro_state_hash, UCORO_STATE, sizeof(UCORO_STATE) - 1);
519 HV * stash = gv_stashpvn("Coro::State", 10, TRUE); 759 coro_state_stash = gv_stashpv ("Coro::State", TRUE);
520 760
521 newCONSTSUB (stash, "SAVE_DEFAV", newSViv (SAVE_DEFAV)); 761 newCONSTSUB (coro_state_stash, "SAVE_DEFAV", newSViv (TRANSFER_SAVE_DEFAV));
522 newCONSTSUB (stash, "SAVE_DEFSV", newSViv (SAVE_DEFSV)); 762 newCONSTSUB (coro_state_stash, "SAVE_DEFSV", newSViv (TRANSFER_SAVE_DEFSV));
523 newCONSTSUB (stash, "SAVE_ERRSV", newSViv (SAVE_ERRSV)); 763 newCONSTSUB (coro_state_stash, "SAVE_ERRSV", newSViv (TRANSFER_SAVE_ERRSV));
764 newCONSTSUB (coro_state_stash, "SAVE_CCTXT", newSViv (TRANSFER_SAVE_CCTXT));
524 765
525 if (!padlist_cache) 766 if (!padlist_cache)
526 padlist_cache = newHV (); 767 padlist_cache = newHV ();
768
769 main_mainstack = PL_mainstack;
527} 770}
528 771
529Coro::State 772Coro::State
530_newprocess(args) 773_newprocess(args)
531 SV * args 774 SV * args
536 if (!SvROK (args) || SvTYPE (SvRV (args)) != SVt_PVAV) 779 if (!SvROK (args) || SvTYPE (SvRV (args)) != SVt_PVAV)
537 croak ("Coro::State::_newprocess expects an arrayref"); 780 croak ("Coro::State::_newprocess expects an arrayref");
538 781
539 New (0, coro, 1, struct coro); 782 New (0, coro, 1, struct coro);
540 783
784 coro->args = (AV *)SvREFCNT_inc (SvRV (args));
541 coro->mainstack = 0; /* actual work is done inside transfer */ 785 coro->mainstack = 0; /* actual work is done inside transfer */
542 coro->args = (AV *)SvREFCNT_inc (SvRV (args)); 786 coro->stack = 0;
543 787
544 RETVAL = coro; 788 RETVAL = coro;
545 OUTPUT: 789 OUTPUT:
546 RETVAL 790 RETVAL
547 791
548void 792void
549transfer(prev, next, flags = SAVE_ALL) 793transfer(prev, next, flags = TRANSFER_SAVE_ALL | TRANSFER_LAZY_STACK)
550 Coro::State_or_hashref prev 794 Coro::State_or_hashref prev
551 Coro::State_or_hashref next 795 Coro::State_or_hashref next
552 int flags 796 int flags
553 PROTOTYPE: @ 797 PROTOTYPE: @
554 CODE: 798 CODE:
555
556 transfer (aTHX_ prev, next, flags); 799 transfer (aTHX_ prev, next, flags);
557 800
558void 801void
559DESTROY(coro) 802DESTROY(coro)
560 Coro::State coro 803 Coro::State coro
561 CODE: 804 CODE:
562 805
563 if (coro->mainstack) 806 if (coro->mainstack && coro->mainstack != main_mainstack)
564 { 807 {
565 struct coro temp; 808 struct coro temp;
566 809
567 SAVE(aTHX_ (&temp), SAVE_ALL); 810 SAVE(aTHX_ (&temp), TRANSFER_SAVE_ALL);
568 LOAD(aTHX_ coro); 811 LOAD(aTHX_ coro);
569 812
570 destroy_stacks (); 813 destroy_stacks (aTHX);
571 814
572 LOAD((&temp)); /* this will get rid of defsv etc.. */ 815 LOAD((&temp)); /* this will get rid of defsv etc.. */
816
817 coro->mainstack = 0;
573 } 818 }
819
820 deallocate_stack (coro);
574 821
575 Safefree (coro); 822 Safefree (coro);
576 823
577void 824void
578flush() 825flush()
581 flush_padlist_cache (); 828 flush_padlist_cache ();
582#endif 829#endif
583 830
584MODULE = Coro::State PACKAGE = Coro::Cont 831MODULE = Coro::State PACKAGE = Coro::Cont
585 832
586# this is dirty (do you hear me?) and should be in it's own .xs 833# this is slightly dirty
587 834
588void 835void
589result(...) 836yield(...)
590 PROTOTYPE: @ 837 PROTOTYPE: @
591 CODE: 838 CODE:
592 static SV *returnstk; 839 static SV *returnstk;
593 SV *sv; 840 SV *sv;
594 AV *defav = GvAV (PL_defgv); 841 AV *defav = GvAV (PL_defgv);
606 mg_get (returnstk); /* isn't documentation wrong for mg_get? */ 853 mg_get (returnstk); /* isn't documentation wrong for mg_get? */
607 sv = av_pop ((AV *)SvRV (returnstk)); 854 sv = av_pop ((AV *)SvRV (returnstk));
608 prev = (struct coro *)SvIV ((SV*)SvRV (*av_fetch ((AV *)SvRV (sv), 0, 0))); 855 prev = (struct coro *)SvIV ((SV*)SvRV (*av_fetch ((AV *)SvRV (sv), 0, 0)));
609 next = (struct coro *)SvIV ((SV*)SvRV (*av_fetch ((AV *)SvRV (sv), 1, 0))); 856 next = (struct coro *)SvIV ((SV*)SvRV (*av_fetch ((AV *)SvRV (sv), 1, 0)));
610 SvREFCNT_dec (sv); 857 SvREFCNT_dec (sv);
858
611 transfer(prev, next, 0); 859 transfer(aTHX_ prev, next, 0);
612 860

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines