… | |
… | |
386 | if (SvREFCNT (padlist)) |
386 | if (SvREFCNT (padlist)) |
387 | { |
387 | { |
388 | I32 i = AvFILLp (padlist); |
388 | I32 i = AvFILLp (padlist); |
389 | while (i >= 0) |
389 | while (i >= 0) |
390 | { |
390 | { |
391 | SV **svp = av_fetch (padlist, i--, FALSE); |
391 | SV **svp = AvARRAY (padlist)[i--]; |
392 | if (svp) |
392 | if (svp) |
393 | { |
393 | { |
394 | SV *sv; |
394 | AvREAL_on (*svp); |
395 | while (&PL_sv_undef != (sv = av_pop ((AV *)*svp))) |
|
|
396 | SvREFCNT_dec (sv); |
395 | av_undef (*svp); |
397 | |
|
|
398 | SvREFCNT_dec (*svp); |
396 | SvREFCNT_dec (*svp); |
399 | } |
397 | } |
400 | } |
398 | } |
401 | |
399 | |
402 | SvREFCNT_dec ((SV*)padlist); |
400 | SvREFCNT_dec ((SV*)padlist); |
… | |
… | |
503 | mg = sv_magicext ((SV *)cv, (SV *)newAV (), CORO_MAGIC_type_cv, &coro_cv_vtbl, 0, 0); |
501 | mg = sv_magicext ((SV *)cv, (SV *)newAV (), CORO_MAGIC_type_cv, &coro_cv_vtbl, 0, 0); |
504 | |
502 | |
505 | av = (AV *)mg->mg_obj; |
503 | av = (AV *)mg->mg_obj; |
506 | |
504 | |
507 | if (expect_false (AvFILLp (av) >= AvMAX (av))) |
505 | if (expect_false (AvFILLp (av) >= AvMAX (av))) |
508 | av_extend (av, AvMAX (av) + 1); |
506 | av_extend (av, AvFILLp (av) + 1); |
509 | |
507 | |
510 | AvARRAY (av)[++AvFILLp (av)] = (SV *)CvPADLIST (cv); |
508 | AvARRAY (av)[++AvFILLp (av)] = (SV *)CvPADLIST (cv); |
511 | } |
509 | } |
512 | |
510 | |
513 | /** load & save, init *******************************************************/ |
511 | /** load & save, init *******************************************************/ |
… | |
… | |
1178 | /* |
1176 | /* |
1179 | * If perl-run returns we assume exit() was being called or the coro |
1177 | * If perl-run returns we assume exit() was being called or the coro |
1180 | * fell off the end, which seems to be the only valid (non-bug) |
1178 | * fell off the end, which seems to be the only valid (non-bug) |
1181 | * reason for perl_run to return. We try to exit by jumping to the |
1179 | * reason for perl_run to return. We try to exit by jumping to the |
1182 | * bootstrap-time "top" top_env, as we cannot restore the "main" |
1180 | * bootstrap-time "top" top_env, as we cannot restore the "main" |
1183 | * coroutine as Coro has no such concept |
1181 | * coroutine as Coro has no such concept. |
|
|
1182 | * This actually isn't valid with the pthread backend, but OSes requiring |
|
|
1183 | * that backend are too broken to do it in a standards-compliant way. |
1184 | */ |
1184 | */ |
1185 | PL_top_env = main_top_env; |
1185 | PL_top_env = main_top_env; |
1186 | JMPENV_JUMP (2); /* I do not feel well about the hardcoded 2 at all */ |
1186 | JMPENV_JUMP (2); /* I do not feel well about the hardcoded 2 at all */ |
1187 | } |
1187 | } |
1188 | } |
1188 | } |
… | |
… | |
2368 | SV **ary; |
2368 | SV **ary; |
2369 | |
2369 | |
2370 | /* unfortunately, building manually saves memory */ |
2370 | /* unfortunately, building manually saves memory */ |
2371 | Newx (ary, 2, SV *); |
2371 | Newx (ary, 2, SV *); |
2372 | AvALLOC (av) = ary; |
2372 | AvALLOC (av) = ary; |
|
|
2373 | #if PERL_VERSION_ATLEAST (5,10,0) |
2373 | /*AvARRAY (av) = ary;*/ |
2374 | AvARRAY (av) = ary; |
|
|
2375 | #else |
2374 | SvPVX ((SV *)av) = (char *)ary; /* 5.8.8 needs this syntax instead of AvARRAY = ary */ |
2376 | /* 5.8.8 needs this syntax instead of AvARRAY = ary, yet */ |
|
|
2377 | /* -DDEBUGGING flags this as a bug, despite it perfectly working */ |
|
|
2378 | SvPVX ((SV *)av) = (char *)ary; |
|
|
2379 | #endif |
2375 | AvMAX (av) = 1; |
2380 | AvMAX (av) = 1; |
2376 | AvFILLp (av) = 0; |
2381 | AvFILLp (av) = 0; |
2377 | ary [0] = newSViv (count); |
2382 | ary [0] = newSViv (count); |
2378 | |
2383 | |
2379 | return newRV_noinc ((SV *)av); |
2384 | return newRV_noinc ((SV *)av); |