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.243 by root, Sat Aug 30 03:07:46 2008 UTC vs.
Revision 1.245 by root, Mon Sep 22 05:40:21 2008 UTC

361 361
362 /* casting is fun. */ 362 /* casting is fun. */
363 while (&PL_sv_undef != (SV *)(padlist = (AV *)av_pop (av))) 363 while (&PL_sv_undef != (SV *)(padlist = (AV *)av_pop (av)))
364 free_padlist (aTHX_ padlist); 364 free_padlist (aTHX_ padlist);
365 365
366 SvREFCNT_dec (av); /* sv_magicext increased the refcount */
367
366 return 0; 368 return 0;
367} 369}
368 370
369#define CORO_MAGIC_type_cv PERL_MAGIC_ext 371#define CORO_MAGIC_type_cv PERL_MAGIC_ext
370#define CORO_MAGIC_type_state PERL_MAGIC_ext 372#define CORO_MAGIC_type_state PERL_MAGIC_ext
420 if (expect_true (mg && AvFILLp ((av = (AV *)mg->mg_obj)) >= 0)) 422 if (expect_true (mg && AvFILLp ((av = (AV *)mg->mg_obj)) >= 0))
421 CvPADLIST (cv) = (AV *)AvARRAY (av)[AvFILLp (av)--]; 423 CvPADLIST (cv) = (AV *)AvARRAY (av)[AvFILLp (av)--];
422 else 424 else
423 { 425 {
424#if CORO_PREFER_PERL_FUNCTIONS 426#if CORO_PREFER_PERL_FUNCTIONS
425 /* this is probably cleaner, but also slower? */ 427 /* this is probably cleaner? but also slower! */
428 /* in practise, it seems to be less stable */
426 CV *cp = Perl_cv_clone (cv); 429 CV *cp = Perl_cv_clone (cv);
427 CvPADLIST (cv) = CvPADLIST (cp); 430 CvPADLIST (cv) = CvPADLIST (cp);
428 CvPADLIST (cp) = 0; 431 CvPADLIST (cp) = 0;
429 SvREFCNT_dec (cp); 432 SvREFCNT_dec (cp);
430#else 433#else
663 #undef VAR 666 #undef VAR
664 } 667 }
665 else 668 else
666 slot = coro->slot; 669 slot = coro->slot;
667 670
671 if (slot)
672 {
668 rss += sizeof (slot->curstackinfo); 673 rss += sizeof (slot->curstackinfo);
669 rss += (slot->curstackinfo->si_cxmax + 1) * sizeof (PERL_CONTEXT); 674 rss += (slot->curstackinfo->si_cxmax + 1) * sizeof (PERL_CONTEXT);
670 rss += sizeof (SV) + sizeof (struct xpvav) + (1 + AvMAX (slot->curstack)) * sizeof (SV *); 675 rss += sizeof (SV) + sizeof (struct xpvav) + (1 + AvMAX (slot->curstack)) * sizeof (SV *);
671 rss += slot->tmps_max * sizeof (SV *); 676 rss += slot->tmps_max * sizeof (SV *);
672 rss += (slot->markstack_max - slot->markstack_ptr) * sizeof (I32); 677 rss += (slot->markstack_max - slot->markstack_ptr) * sizeof (I32);
673 rss += slot->scopestack_max * sizeof (I32); 678 rss += slot->scopestack_max * sizeof (I32);
674 rss += slot->savestack_max * sizeof (ANY); 679 rss += slot->savestack_max * sizeof (ANY);
675 680
676#if !PERL_VERSION_ATLEAST (5,10,0) 681#if !PERL_VERSION_ATLEAST (5,10,0)
677 rss += slot->retstack_max * sizeof (OP *); 682 rss += slot->retstack_max * sizeof (OP *);
678#endif 683#endif
684 }
679 } 685 }
680 686
681 return rss; 687 return rss;
682} 688}
683 689
1814call (Coro::State coro, SV *coderef) 1820call (Coro::State coro, SV *coderef)
1815 ALIAS: 1821 ALIAS:
1816 eval = 1 1822 eval = 1
1817 CODE: 1823 CODE:
1818{ 1824{
1819 if (coro->mainstack) 1825 if (coro->mainstack && ((coro->flags & CF_RUNNING) || coro->slot))
1820 { 1826 {
1821 struct coro temp; 1827 struct coro temp;
1822 1828
1823 if (!(coro->flags & CF_RUNNING)) 1829 if (!(coro->flags & CF_RUNNING))
1824 { 1830 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines