… | |
… | |
266 | /** lowlevel stuff **********************************************************/ |
266 | /** lowlevel stuff **********************************************************/ |
267 | |
267 | |
268 | static SV * |
268 | static SV * |
269 | coro_get_sv (pTHX_ const char *name, int create) |
269 | coro_get_sv (pTHX_ const char *name, int create) |
270 | { |
270 | { |
271 | #if PERL_VERSION_ATLEAST (5,9,0) |
271 | #if PERL_VERSION_ATLEAST (5,10,0) |
272 | /* silence stupid and wrong 5.10 warning that I am unable to switch off */ |
272 | /* silence stupid and wrong 5.10 warning that I am unable to switch off */ |
273 | get_sv (name, create); |
273 | get_sv (name, create); |
274 | #endif |
274 | #endif |
275 | return get_sv (name, create); |
275 | return get_sv (name, create); |
276 | } |
276 | } |
277 | |
277 | |
278 | static AV * |
278 | static AV * |
279 | coro_get_av (pTHX_ const char *name, int create) |
279 | coro_get_av (pTHX_ const char *name, int create) |
280 | { |
280 | { |
281 | #if PERL_VERSION_ATLEAST (5,9,0) |
281 | #if PERL_VERSION_ATLEAST (5,10,0) |
282 | /* silence stupid and wrong 5.10 warning that I am unable to switch off */ |
282 | /* silence stupid and wrong 5.10 warning that I am unable to switch off */ |
283 | get_av (name, create); |
283 | get_av (name, create); |
284 | #endif |
284 | #endif |
285 | return get_av (name, create); |
285 | return get_av (name, create); |
286 | } |
286 | } |
287 | |
287 | |
288 | static HV * |
288 | static HV * |
289 | coro_get_hv (pTHX_ const char *name, int create) |
289 | coro_get_hv (pTHX_ const char *name, int create) |
290 | { |
290 | { |
291 | #if PERL_VERSION_ATLEAST (5,9,0) |
291 | #if PERL_VERSION_ATLEAST (5,10,0) |
292 | /* silence stupid and wrong 5.10 warning that I am unable to switch off */ |
292 | /* silence stupid and wrong 5.10 warning that I am unable to switch off */ |
293 | get_hv (name, create); |
293 | get_hv (name, create); |
294 | #endif |
294 | #endif |
295 | return get_hv (name, create); |
295 | return get_hv (name, create); |
296 | } |
296 | } |
… | |
… | |
301 | AV *padlist = CvPADLIST (cv); |
301 | AV *padlist = CvPADLIST (cv); |
302 | AV *newpadlist, *newpad; |
302 | AV *newpadlist, *newpad; |
303 | |
303 | |
304 | newpadlist = newAV (); |
304 | newpadlist = newAV (); |
305 | AvREAL_off (newpadlist); |
305 | AvREAL_off (newpadlist); |
306 | #if PERL_VERSION_ATLEAST (5,9,0) |
306 | #if PERL_VERSION_ATLEAST (5,10,0) |
307 | Perl_pad_push (aTHX_ padlist, AvFILLp (padlist) + 1); |
307 | Perl_pad_push (aTHX_ padlist, AvFILLp (padlist) + 1); |
308 | #else |
308 | #else |
309 | Perl_pad_push (aTHX_ padlist, AvFILLp (padlist) + 1, 1); |
309 | Perl_pad_push (aTHX_ padlist, AvFILLp (padlist) + 1, 1); |
310 | #endif |
310 | #endif |
311 | newpad = (AV *)AvARRAY (padlist)[AvFILLp (padlist)]; |
311 | newpad = (AV *)AvARRAY (padlist)[AvFILLp (padlist)]; |
… | |
… | |
592 | |
592 | |
593 | New(54,PL_savestack,24,ANY); |
593 | New(54,PL_savestack,24,ANY); |
594 | PL_savestack_ix = 0; |
594 | PL_savestack_ix = 0; |
595 | PL_savestack_max = 24; |
595 | PL_savestack_max = 24; |
596 | |
596 | |
597 | #if !PERL_VERSION_ATLEAST (5,9,0) |
597 | #if !PERL_VERSION_ATLEAST (5,10,0) |
598 | New(54,PL_retstack,4,OP*); |
598 | New(54,PL_retstack,4,OP*); |
599 | PL_retstack_ix = 0; |
599 | PL_retstack_ix = 0; |
600 | PL_retstack_max = 4; |
600 | PL_retstack_max = 4; |
601 | #endif |
601 | #endif |
602 | } |
602 | } |
… | |
… | |
625 | |
625 | |
626 | Safefree (PL_tmps_stack); |
626 | Safefree (PL_tmps_stack); |
627 | Safefree (PL_markstack); |
627 | Safefree (PL_markstack); |
628 | Safefree (PL_scopestack); |
628 | Safefree (PL_scopestack); |
629 | Safefree (PL_savestack); |
629 | Safefree (PL_savestack); |
630 | #if !PERL_VERSION_ATLEAST (5,9,0) |
630 | #if !PERL_VERSION_ATLEAST (5,10,0) |
631 | Safefree (PL_retstack); |
631 | Safefree (PL_retstack); |
632 | #endif |
632 | #endif |
633 | } |
633 | } |
634 | |
634 | |
635 | static size_t |
635 | static size_t |
… | |
… | |
659 | rss += slot->tmps_max * sizeof (SV *); |
659 | rss += slot->tmps_max * sizeof (SV *); |
660 | rss += (slot->markstack_max - slot->markstack_ptr) * sizeof (I32); |
660 | rss += (slot->markstack_max - slot->markstack_ptr) * sizeof (I32); |
661 | rss += slot->scopestack_max * sizeof (I32); |
661 | rss += slot->scopestack_max * sizeof (I32); |
662 | rss += slot->savestack_max * sizeof (ANY); |
662 | rss += slot->savestack_max * sizeof (ANY); |
663 | |
663 | |
664 | #if !PERL_VERSION_ATLEAST (5,9,0) |
664 | #if !PERL_VERSION_ATLEAST (5,10,0) |
665 | rss += slot->retstack_max * sizeof (OP *); |
665 | rss += slot->retstack_max * sizeof (OP *); |
666 | #endif |
666 | #endif |
667 | } |
667 | } |
668 | |
668 | |
669 | return rss; |
669 | return rss; |
… | |
… | |
736 | PL_curpm = 0; |
736 | PL_curpm = 0; |
737 | PL_curpad = 0; |
737 | PL_curpad = 0; |
738 | PL_localizing = 0; |
738 | PL_localizing = 0; |
739 | PL_dirty = 0; |
739 | PL_dirty = 0; |
740 | PL_restartop = 0; |
740 | PL_restartop = 0; |
|
|
741 | #if !PERL_VERSION_ATLEAST (5,10,0) |
|
|
742 | PL_parser = 0; |
|
|
743 | #endif |
741 | |
744 | |
742 | /* recreate the die/warn hooks */ |
745 | /* recreate the die/warn hooks */ |
743 | PL_diehook = 0; SvSetMagicSV (*hv_fetch (hv_sig, "__DIE__" , sizeof ("__DIE__" ) - 1, 1), rv_diehook ); |
746 | PL_diehook = 0; SvSetMagicSV (*hv_fetch (hv_sig, "__DIE__" , sizeof ("__DIE__" ) - 1, 1), rv_diehook ); |
744 | PL_warnhook = 0; SvSetMagicSV (*hv_fetch (hv_sig, "__WARN__", sizeof ("__WARN__") - 1, 1), rv_warnhook); |
747 | PL_warnhook = 0; SvSetMagicSV (*hv_fetch (hv_sig, "__WARN__", sizeof ("__WARN__") - 1, 1), rv_warnhook); |
745 | |
748 | |
… | |
… | |
1126 | croak ("Coro::State::transfer called with running next Coro::State, but can only transfer to inactive states"); |
1129 | croak ("Coro::State::transfer called with running next Coro::State, but can only transfer to inactive states"); |
1127 | |
1130 | |
1128 | if (expect_false (next->flags & CF_DESTROYED)) |
1131 | if (expect_false (next->flags & CF_DESTROYED)) |
1129 | croak ("Coro::State::transfer called with destroyed next Coro::State, but can only transfer to inactive states"); |
1132 | croak ("Coro::State::transfer called with destroyed next Coro::State, but can only transfer to inactive states"); |
1130 | |
1133 | |
1131 | if ( |
|
|
1132 | #if PERL_VERSION_ATLEAST (5,9,0) |
1134 | #if !PERL_VERSION_ATLEAST (5,10,0) |
1133 | expect_false (PL_parser && PL_parser->lex_state != LEX_NOTPARSING) |
|
|
1134 | #else |
|
|
1135 | expect_false (PL_lex_state != LEX_NOTPARSING) |
1135 | if (expect_false (PL_lex_state != LEX_NOTPARSING) |
1136 | #endif |
|
|
1137 | ) |
|
|
1138 | croak ("Coro::State::transfer called while parsing, but this is not supported"); |
1136 | croak ("Coro::State::transfer called while parsing, but this is not supported"); |
|
|
1137 | #endif |
1139 | } |
1138 | } |
1140 | } |
1139 | } |
1141 | |
1140 | |
1142 | /* always use the TRANSFER macro */ |
1141 | /* always use the TRANSFER macro */ |
1143 | static void NOINLINE |
1142 | static void NOINLINE |