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.70 by root, Mon Dec 26 19:26:52 2005 UTC vs.
Revision 1.73 by root, Sat Feb 4 06:01:13 2006 UTC

171 av_store (newpadlist, 1, (SV *) newpad); 171 av_store (newpadlist, 1, (SV *) newpad);
172 172
173 av = newAV (); /* will be @_ */ 173 av = newAV (); /* will be @_ */
174 av_extend (av, 0); 174 av_extend (av, 0);
175 av_store (newpad, 0, (SV *) av); 175 av_store (newpad, 0, (SV *) av);
176 AvFLAGS (av) = AVf_REIFY; 176 AvREIFY_on (av);
177 177
178 for (ix = fpad; ix > 0; ix--) 178 for (ix = fpad; ix > 0; ix--)
179 { 179 {
180 SV *namesv = (ix <= fname) ? pname[ix] : Nullsv; 180 SV *namesv = (ix <= fname) ? pname[ix] : Nullsv;
181 181
346 PL_scopestack_ix = c->scopestack_ix; 346 PL_scopestack_ix = c->scopestack_ix;
347 PL_scopestack_max = c->scopestack_max; 347 PL_scopestack_max = c->scopestack_max;
348 PL_savestack = c->savestack; 348 PL_savestack = c->savestack;
349 PL_savestack_ix = c->savestack_ix; 349 PL_savestack_ix = c->savestack_ix;
350 PL_savestack_max = c->savestack_max; 350 PL_savestack_max = c->savestack_max;
351#if PERL_VERSION < 9
351 PL_retstack = c->retstack; 352 PL_retstack = c->retstack;
352 PL_retstack_ix = c->retstack_ix; 353 PL_retstack_ix = c->retstack_ix;
353 PL_retstack_max = c->retstack_max; 354 PL_retstack_max = c->retstack_max;
355#endif
354 PL_curpm = c->curpm; 356 PL_curpm = c->curpm;
355 PL_curcop = c->curcop; 357 PL_curcop = c->curcop;
356 PL_top_env = c->top_env; 358 PL_top_env = c->top_env;
357 359
358 if (c->defav) REPLACE_SV (GvAV (PL_defgv), c->defav); 360 if (c->defav) REPLACE_SV (GvAV (PL_defgv), c->defav);
472 c->scopestack_ix = PL_scopestack_ix; 474 c->scopestack_ix = PL_scopestack_ix;
473 c->scopestack_max = PL_scopestack_max; 475 c->scopestack_max = PL_scopestack_max;
474 c->savestack = PL_savestack; 476 c->savestack = PL_savestack;
475 c->savestack_ix = PL_savestack_ix; 477 c->savestack_ix = PL_savestack_ix;
476 c->savestack_max = PL_savestack_max; 478 c->savestack_max = PL_savestack_max;
479#if PERL_VERSION < 9
477 c->retstack = PL_retstack; 480 c->retstack = PL_retstack;
478 c->retstack_ix = PL_retstack_ix; 481 c->retstack_ix = PL_retstack_ix;
479 c->retstack_max = PL_retstack_max; 482 c->retstack_max = PL_retstack_max;
483#endif
480 c->curpm = PL_curpm; 484 c->curpm = PL_curpm;
481 c->curcop = PL_curcop; 485 c->curcop = PL_curcop;
482 c->top_env = PL_top_env; 486 c->top_env = PL_top_env;
483} 487}
484 488
521 525
522 New(54,PL_savestack,96,ANY); 526 New(54,PL_savestack,96,ANY);
523 PL_savestack_ix = 0; 527 PL_savestack_ix = 0;
524 PL_savestack_max = 96; 528 PL_savestack_max = 96;
525 529
530#if PERL_VERSION < 9
526 New(54,PL_retstack,8,OP*); 531 New(54,PL_retstack,8,OP*);
527 PL_retstack_ix = 0; 532 PL_retstack_ix = 0;
528 PL_retstack_max = 8; 533 PL_retstack_max = 8;
534#endif
529 535
530 UNLOCK; 536 UNLOCK;
531} 537}
532 538
533/* 539/*
573 579
574 Safefree (PL_tmps_stack); 580 Safefree (PL_tmps_stack);
575 Safefree (PL_markstack); 581 Safefree (PL_markstack);
576 Safefree (PL_scopestack); 582 Safefree (PL_scopestack);
577 Safefree (PL_savestack); 583 Safefree (PL_savestack);
584#if PERL_VERSION < 9
578 Safefree (PL_retstack); 585 Safefree (PL_retstack);
586#endif
579} 587}
580 588
581static void 589static void
582allocate_stack (Coro__State ctx, int alloc) 590allocate_stack (Coro__State ctx, int alloc)
583{ 591{
859static int coro_nready; 867static int coro_nready;
860 868
861static void 869static void
862coro_enq (pTHX_ SV *sv) 870coro_enq (pTHX_ SV *sv)
863{ 871{
864 if (SvTYPE (sv) == SVt_PVHV) 872 if (SvTYPE (sv) != SVt_PVHV)
865 {
866 SV **xprio = hv_fetch ((HV *)sv, "prio", 4, 0);
867 int prio = xprio ? SvIV (*xprio) : PRIO_NORMAL;
868
869 prio = prio > PRIO_MAX ? PRIO_MAX
870 : prio < PRIO_MIN ? PRIO_MIN
871 : prio;
872
873 av_push (coro_ready [prio - PRIO_MIN], sv);
874 coro_nready++;
875
876 return;
877 }
878
879 croak ("Coro::ready tried to enqueue something that is not a coroutine"); 873 croak ("Coro::ready tried to enqueue something that is not a coroutine");
874
875 SV **xprio = hv_fetch ((HV *)sv, "prio", 4, 0);
876 int prio = xprio ? SvIV (*xprio) : PRIO_NORMAL;
877
878 prio = prio > PRIO_MAX ? PRIO_MAX
879 : prio < PRIO_MIN ? PRIO_MIN
880 : prio;
881
882 av_push (coro_ready [prio - PRIO_MIN], sv);
883 coro_nready++;
880} 884}
881 885
882static SV * 886static SV *
883coro_deq (pTHX_ int min_prio) 887coro_deq (pTHX_ int min_prio)
884{ 888{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines