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.433 by root, Thu May 9 05:40:14 2013 UTC vs.
Revision 1.437 by root, Tue Nov 5 15:13:42 2013 UTC

26#ifndef SVs_PADSTALE 26#ifndef SVs_PADSTALE
27# define SVs_PADSTALE 0 27# define SVs_PADSTALE 0
28#endif 28#endif
29 29
30#ifdef PadARRAY 30#ifdef PadARRAY
31# define NEWPADAPI 31# define NEWPADAPI 1
32# define newPADLIST(var) (Newz (0, var, 1, PADLIST), Newx (PadlistARRAY (var), 2, PAD *)) 32# define newPADLIST(var) (Newz (0, var, 1, PADLIST), Newx (PadlistARRAY (var), 2, PAD *))
33#else 33#else
34typedef AV PADNAMELIST; 34typedef AV PADNAMELIST;
35# if !PERL_VERSION_ATLEAST(5,8,0) 35# if !PERL_VERSION_ATLEAST(5,8,0)
36typedef AV PADLIST; 36typedef AV PADLIST;
42# define PadARRAY AvARRAY 42# define PadARRAY AvARRAY
43# define PadMAX AvFILLp 43# define PadMAX AvFILLp
44# define newPADLIST(var) ((var) = newAV (), av_extend (var, 1)) 44# define newPADLIST(var) ((var) = newAV (), av_extend (var, 1))
45#endif 45#endif
46 46
47/* 5.19.something has replaced SVt_BIND by SVt_INVLIST */
48/* we just alias it to SVt_IV, as that is sufficient for swap_sv for now */
49#if PERL_VERSION_ATLEAST(5,19,0)
50# define SVt_BIND SVt_IV
51#endif
52
47#if defined(_WIN32) 53#if defined(_WIN32)
48# undef HAS_GETTIMEOFDAY 54# undef HAS_GETTIMEOFDAY
49# undef setjmp 55# undef setjmp
50# undef longjmp 56# undef longjmp
51# undef _exit 57# undef _exit
511coro_derive_padlist (pTHX_ CV *cv) 517coro_derive_padlist (pTHX_ CV *cv)
512{ 518{
513 PADLIST *padlist = CvPADLIST (cv); 519 PADLIST *padlist = CvPADLIST (cv);
514 PADLIST *newpadlist; 520 PADLIST *newpadlist;
515 PAD *newpad; 521 PAD *newpad;
516 PADOFFSET const off = PadlistMAX (padlist) + 1; 522 PADOFFSET off = PadlistMAX (padlist) + 1;
517 523
518 newPADLIST(newpadlist); 524#if NEWPADAPI
519#if !PERL_VERSION_ATLEAST(5,15,3) 525
520 /* Padlists are AvREAL as of 5.15.3. See perl bug #98092 and perl commit 7d953ba. */ 526 /* if we had the original CvDEPTH, we might be able to steal the CvDEPTH+1 entry instead */
521 AvREAL_off (newpadlist); 527 /* 20131102194744.GA6705@schmorp.de, 20131102195825.2013.qmail@lists-nntp.develooper.com */
522#endif 528 while (!PadlistARRAY (padlist)[off - 1])
529 --off;
530
531 Perl_pad_push (aTHX_ padlist, off);
532
533 newpad = PadlistARRAY (padlist)[off];
534 PadlistARRAY (padlist)[off] = 0;
535
536#else
537
523#if PERL_VERSION_ATLEAST (5,10,0) 538#if PERL_VERSION_ATLEAST (5,10,0)
524 Perl_pad_push (aTHX_ padlist, off); 539 Perl_pad_push (aTHX_ padlist, off);
525#else 540#else
526 Perl_pad_push (aTHX_ padlist, off, 1); 541 Perl_pad_push (aTHX_ padlist, off, 1);
527#endif 542#endif
543
528 newpad = PadlistARRAY (padlist)[off]; 544 newpad = PadlistARRAY (padlist)[off];
529 PadlistMAX (padlist) = off - 1; 545 PadlistMAX (padlist) = off - 1;
546
547#endif
548
549 newPADLIST (newpadlist);
550#if !PERL_VERSION_ATLEAST(5,15,3)
551 /* Padlists are AvREAL as of 5.15.3. See perl bug #98092 and perl commit 7d953ba. */
552 AvREAL_off (newpadlist);
553#endif
530 554
531 /* Already extended to 2 elements by newPADLIST. */ 555 /* Already extended to 2 elements by newPADLIST. */
532 PadlistMAX (newpadlist) = 1; 556 PadlistMAX (newpadlist) = 1;
533 PadlistNAMES (newpadlist) = (PADNAMELIST *)SvREFCNT_inc_NN (PadlistNAMES (padlist)); 557 PadlistNAMES (newpadlist) = (PADNAMELIST *)SvREFCNT_inc_NN (PadlistNAMES (padlist));
534 PadlistARRAY (newpadlist)[1] = newpad; 558 PadlistARRAY (newpadlist)[1] = newpad;
557 SvREFCNT_dec (pad); 581 SvREFCNT_dec (pad);
558 } 582 }
559 583
560 SvREFCNT_dec (PadlistNAMES (padlist)); 584 SvREFCNT_dec (PadlistNAMES (padlist));
561 585
562#ifdef NEWPADAPI 586#if NEWPADAPI
563 Safefree (PadlistARRAY (padlist)); 587 Safefree (PadlistARRAY (padlist));
564 Safefree (padlist); 588 Safefree (padlist);
565#else 589#else
566 AvFILLp (padlist) = -1; 590 AvFILLp (padlist) = -1;
567 AvREAL_off (padlist); 591 AvREAL_off (padlist);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines