… | |
… | |
101 | # define CvISXSUB_on(cv) (void)cv |
101 | # define CvISXSUB_on(cv) (void)cv |
102 | #endif |
102 | #endif |
103 | #ifndef CvISXSUB |
103 | #ifndef CvISXSUB |
104 | # define CvISXSUB(cv) (CvXSUB (cv) ? TRUE : FALSE) |
104 | # define CvISXSUB(cv) (CvXSUB (cv) ? TRUE : FALSE) |
105 | #endif |
105 | #endif |
|
|
106 | #ifndef Newx |
|
|
107 | # define Newx(ptr,nitems,type) New (0,ptr,nitems,type) |
|
|
108 | #endif |
106 | |
109 | |
107 | /* 5.8.7 */ |
110 | /* 5.8.7 */ |
108 | #ifndef SvRV_set |
111 | #ifndef SvRV_set |
109 | # define SvRV_set(s,v) SvRV(s) = (v) |
112 | # define SvRV_set(s,v) SvRV(s) = (v) |
110 | #endif |
113 | #endif |
… | |
… | |
130 | #else |
133 | #else |
131 | # define dSTACKLEVEL volatile void *stacklevel |
134 | # define dSTACKLEVEL volatile void *stacklevel |
132 | # define STACKLEVEL ((void *)&stacklevel) |
135 | # define STACKLEVEL ((void *)&stacklevel) |
133 | #endif |
136 | #endif |
134 | |
137 | |
135 | #define IN_DESTRUCT (PL_main_cv == Nullcv) |
138 | #define IN_DESTRUCT PL_dirty |
136 | |
139 | |
137 | #if __GNUC__ >= 3 |
140 | #if __GNUC__ >= 3 |
138 | # define attribute(x) __attribute__(x) |
141 | # define attribute(x) __attribute__(x) |
139 | # define expect(expr,value) __builtin_expect ((expr),(value)) |
142 | # define expect(expr,value) __builtin_expect ((expr),(value)) |
140 | # define INLINE static inline |
143 | # define INLINE static inline |
… | |
… | |
172 | static HV *coro_state_stash, *coro_stash; |
175 | static HV *coro_state_stash, *coro_stash; |
173 | static volatile SV *coro_mortal; /* will be freed/thrown after next transfer */ |
176 | static volatile SV *coro_mortal; /* will be freed/thrown after next transfer */ |
174 | |
177 | |
175 | static AV *av_destroy; /* destruction queue */ |
178 | static AV *av_destroy; /* destruction queue */ |
176 | static SV *sv_manager; /* the manager coro */ |
179 | static SV *sv_manager; /* the manager coro */ |
|
|
180 | static SV *sv_idle; /* $Coro::idle */ |
177 | |
181 | |
178 | static GV *irsgv; /* $/ */ |
182 | static GV *irsgv; /* $/ */ |
179 | static GV *stdoutgv; /* *STDOUT */ |
183 | static GV *stdoutgv; /* *STDOUT */ |
180 | static SV *rv_diehook; |
184 | static SV *rv_diehook; |
181 | static SV *rv_warnhook; |
185 | static SV *rv_warnhook; |
… | |
… | |
225 | int valgrind_id; |
229 | int valgrind_id; |
226 | #endif |
230 | #endif |
227 | unsigned char flags; |
231 | unsigned char flags; |
228 | } coro_cctx; |
232 | } coro_cctx; |
229 | |
233 | |
|
|
234 | coro_cctx *cctx_current; /* the currently running cctx */ |
|
|
235 | |
|
|
236 | /*****************************************************************************/ |
|
|
237 | |
230 | enum { |
238 | enum { |
231 | CF_RUNNING = 0x0001, /* coroutine is running */ |
239 | CF_RUNNING = 0x0001, /* coroutine is running */ |
232 | CF_READY = 0x0002, /* coroutine is ready */ |
240 | CF_READY = 0x0002, /* coroutine is ready */ |
233 | CF_NEW = 0x0004, /* has never been switched to */ |
241 | CF_NEW = 0x0004, /* has never been switched to */ |
234 | CF_DESTROYED = 0x0008, /* coroutine data has been freed */ |
242 | CF_DESTROYED = 0x0008, /* coroutine data has been freed */ |
… | |
… | |
239 | { |
247 | { |
240 | SV *defsv; |
248 | SV *defsv; |
241 | AV *defav; |
249 | AV *defav; |
242 | SV *errsv; |
250 | SV *errsv; |
243 | SV *irsgv; |
251 | SV *irsgv; |
|
|
252 | HV *hinthv; |
244 | #define VAR(name,type) type name; |
253 | #define VAR(name,type) type name; |
245 | # include "state.h" |
254 | # include "state.h" |
246 | #undef VAR |
255 | #undef VAR |
247 | } perl_slots; |
256 | } perl_slots; |
248 | |
257 | |
… | |
… | |
347 | GV *gvp; |
356 | GV *gvp; |
348 | return sv_2cv (sv, &st, &gvp, 0); |
357 | return sv_2cv (sv, &st, &gvp, 0); |
349 | } |
358 | } |
350 | |
359 | |
351 | static AV * |
360 | static AV * |
352 | coro_clone_padlist (pTHX_ CV *cv) |
361 | coro_derive_padlist (pTHX_ CV *cv) |
353 | { |
362 | { |
354 | AV *padlist = CvPADLIST (cv); |
363 | AV *padlist = CvPADLIST (cv); |
355 | AV *newpadlist, *newpad; |
364 | AV *newpadlist, *newpad; |
356 | |
365 | |
357 | newpadlist = newAV (); |
366 | newpadlist = newAV (); |
… | |
… | |
372 | |
381 | |
373 | static void |
382 | static void |
374 | free_padlist (pTHX_ AV *padlist) |
383 | free_padlist (pTHX_ AV *padlist) |
375 | { |
384 | { |
376 | /* may be during global destruction */ |
385 | /* may be during global destruction */ |
377 | if (SvREFCNT (padlist)) |
386 | if (!IN_DESTRUCT) |
378 | { |
387 | { |
379 | I32 i = AvFILLp (padlist); |
388 | I32 i = AvFILLp (padlist); |
|
|
389 | |
380 | while (i >= 0) |
390 | while (i >= 0) |
381 | { |
391 | { |
382 | SV **svp = av_fetch (padlist, i--, FALSE); |
392 | /* we try to be extra-careful here */ |
383 | if (svp) |
393 | AV *av = (AV *)AvARRAY (padlist)[i--]; |
384 | { |
394 | |
385 | SV *sv; |
395 | I32 i = AvFILLp (av); |
386 | while (&PL_sv_undef != (sv = av_pop ((AV *)*svp))) |
396 | |
|
|
397 | while (i >= 0) |
|
|
398 | SvREFCNT_dec (AvARRAY (av)[i--]); |
|
|
399 | |
|
|
400 | AvFILLp (av) = -1; |
387 | SvREFCNT_dec (sv); |
401 | SvREFCNT_dec (av); |
388 | |
|
|
389 | SvREFCNT_dec (*svp); |
|
|
390 | } |
|
|
391 | } |
402 | } |
392 | |
403 | |
|
|
404 | AvFILLp (padlist) = -1; |
393 | SvREFCNT_dec ((SV*)padlist); |
405 | SvREFCNT_dec ((SV*)padlist); |
394 | } |
406 | } |
395 | } |
407 | } |
396 | |
408 | |
397 | static int |
409 | static int |
… | |
… | |
477 | CV *cp = Perl_cv_clone (aTHX_ cv); |
489 | CV *cp = Perl_cv_clone (aTHX_ cv); |
478 | CvPADLIST (cv) = CvPADLIST (cp); |
490 | CvPADLIST (cv) = CvPADLIST (cp); |
479 | CvPADLIST (cp) = 0; |
491 | CvPADLIST (cp) = 0; |
480 | SvREFCNT_dec (cp); |
492 | SvREFCNT_dec (cp); |
481 | #else |
493 | #else |
482 | CvPADLIST (cv) = coro_clone_padlist (aTHX_ cv); |
494 | CvPADLIST (cv) = coro_derive_padlist (aTHX_ cv); |
483 | #endif |
495 | #endif |
484 | } |
496 | } |
485 | } |
497 | } |
486 | |
498 | |
487 | static void |
499 | static void |
… | |
… | |
494 | mg = sv_magicext ((SV *)cv, (SV *)newAV (), CORO_MAGIC_type_cv, &coro_cv_vtbl, 0, 0); |
506 | mg = sv_magicext ((SV *)cv, (SV *)newAV (), CORO_MAGIC_type_cv, &coro_cv_vtbl, 0, 0); |
495 | |
507 | |
496 | av = (AV *)mg->mg_obj; |
508 | av = (AV *)mg->mg_obj; |
497 | |
509 | |
498 | if (expect_false (AvFILLp (av) >= AvMAX (av))) |
510 | if (expect_false (AvFILLp (av) >= AvMAX (av))) |
499 | av_extend (av, AvMAX (av) + 1); |
511 | av_extend (av, AvFILLp (av) + 1); |
500 | |
512 | |
501 | AvARRAY (av)[++AvFILLp (av)] = (SV *)CvPADLIST (cv); |
513 | AvARRAY (av)[++AvFILLp (av)] = (SV *)CvPADLIST (cv); |
502 | } |
514 | } |
503 | |
515 | |
504 | /** load & save, init *******************************************************/ |
516 | /** load & save, init *******************************************************/ |
… | |
… | |
509 | perl_slots *slot = c->slot; |
521 | perl_slots *slot = c->slot; |
510 | c->slot = 0; |
522 | c->slot = 0; |
511 | |
523 | |
512 | PL_mainstack = c->mainstack; |
524 | PL_mainstack = c->mainstack; |
513 | |
525 | |
514 | GvSV (PL_defgv) = slot->defsv; |
526 | GvSV (PL_defgv) = slot->defsv; |
515 | GvAV (PL_defgv) = slot->defav; |
527 | GvAV (PL_defgv) = slot->defav; |
516 | GvSV (PL_errgv) = slot->errsv; |
528 | GvSV (PL_errgv) = slot->errsv; |
517 | GvSV (irsgv) = slot->irsgv; |
529 | GvSV (irsgv) = slot->irsgv; |
|
|
530 | GvHV (PL_hintgv) = slot->hinthv; |
518 | |
531 | |
519 | #define VAR(name,type) PL_ ## name = slot->name; |
532 | #define VAR(name,type) PL_ ## name = slot->name; |
520 | # include "state.h" |
533 | # include "state.h" |
521 | #undef VAR |
534 | #undef VAR |
522 | |
535 | |
… | |
… | |
608 | c->mainstack = PL_mainstack; |
621 | c->mainstack = PL_mainstack; |
609 | |
622 | |
610 | { |
623 | { |
611 | perl_slots *slot = c->slot = (perl_slots *)(cxstack + cxstack_ix + 1); |
624 | perl_slots *slot = c->slot = (perl_slots *)(cxstack + cxstack_ix + 1); |
612 | |
625 | |
613 | slot->defav = GvAV (PL_defgv); |
626 | slot->defav = GvAV (PL_defgv); |
614 | slot->defsv = DEFSV; |
627 | slot->defsv = DEFSV; |
615 | slot->errsv = ERRSV; |
628 | slot->errsv = ERRSV; |
616 | slot->irsgv = GvSV (irsgv); |
629 | slot->irsgv = GvSV (irsgv); |
|
|
630 | slot->hinthv = GvHV (PL_hintgv); |
617 | |
631 | |
618 | #define VAR(name,type) slot->name = PL_ ## name; |
632 | #define VAR(name,type) slot->name = PL_ ## name; |
619 | # include "state.h" |
633 | # include "state.h" |
620 | #undef VAR |
634 | #undef VAR |
621 | } |
635 | } |
… | |
… | |
857 | |
871 | |
858 | PL_runops = RUNOPS_DEFAULT; |
872 | PL_runops = RUNOPS_DEFAULT; |
859 | PL_curcop = &PL_compiling; |
873 | PL_curcop = &PL_compiling; |
860 | PL_in_eval = EVAL_NULL; |
874 | PL_in_eval = EVAL_NULL; |
861 | PL_comppad = 0; |
875 | PL_comppad = 0; |
|
|
876 | PL_comppad_name = 0; |
|
|
877 | PL_comppad_name_fill = 0; |
|
|
878 | PL_comppad_name_floor = 0; |
862 | PL_curpm = 0; |
879 | PL_curpm = 0; |
863 | PL_curpad = 0; |
880 | PL_curpad = 0; |
864 | PL_localizing = 0; |
881 | PL_localizing = 0; |
865 | PL_dirty = 0; |
882 | PL_dirty = 0; |
866 | PL_restartop = 0; |
883 | PL_restartop = 0; |
867 | #if PERL_VERSION_ATLEAST (5,10,0) |
884 | #if PERL_VERSION_ATLEAST (5,10,0) |
868 | PL_parser = 0; |
885 | PL_parser = 0; |
869 | #endif |
886 | #endif |
|
|
887 | PL_hints = 0; |
870 | |
888 | |
871 | /* recreate the die/warn hooks */ |
889 | /* recreate the die/warn hooks */ |
872 | PL_diehook = 0; SvSetMagicSV (*hv_fetch (hv_sig, "__DIE__" , sizeof ("__DIE__" ) - 1, 1), rv_diehook ); |
890 | PL_diehook = 0; SvSetMagicSV (*hv_fetch (hv_sig, "__DIE__" , sizeof ("__DIE__" ) - 1, 1), rv_diehook ); |
873 | PL_warnhook = 0; SvSetMagicSV (*hv_fetch (hv_sig, "__WARN__", sizeof ("__WARN__") - 1, 1), rv_warnhook); |
891 | PL_warnhook = 0; SvSetMagicSV (*hv_fetch (hv_sig, "__WARN__", sizeof ("__WARN__") - 1, 1), rv_warnhook); |
874 | |
892 | |
875 | GvSV (PL_defgv) = newSV (0); |
893 | GvSV (PL_defgv) = newSV (0); |
876 | GvAV (PL_defgv) = coro->args; coro->args = 0; |
894 | GvAV (PL_defgv) = coro->args; coro->args = 0; |
877 | GvSV (PL_errgv) = newSV (0); |
895 | GvSV (PL_errgv) = newSV (0); |
878 | GvSV (irsgv) = newSVpvn ("\n", 1); sv_magic (GvSV (irsgv), (SV *)irsgv, PERL_MAGIC_sv, "/", 0); |
896 | GvSV (irsgv) = newSVpvn ("\n", 1); sv_magic (GvSV (irsgv), (SV *)irsgv, PERL_MAGIC_sv, "/", 0); |
|
|
897 | GvHV (PL_hintgv) = 0; |
879 | PL_rs = newSVsv (GvSV (irsgv)); |
898 | PL_rs = newSVsv (GvSV (irsgv)); |
880 | PL_defoutgv = (GV *)SvREFCNT_inc_NN (stdoutgv); |
899 | PL_defoutgv = (GV *)SvREFCNT_inc_NN (stdoutgv); |
881 | |
900 | |
882 | { |
901 | { |
883 | dSP; |
902 | dSP; |
… | |
… | |
901 | slf_frame.prepare = prepare_nop; /* provide a nop function for an eventual pp_slf */ |
920 | slf_frame.prepare = prepare_nop; /* provide a nop function for an eventual pp_slf */ |
902 | slf_frame.check = slf_check_nop; /* signal pp_slf to not repeat */ |
921 | slf_frame.check = slf_check_nop; /* signal pp_slf to not repeat */ |
903 | |
922 | |
904 | /* and we have to provide the pp_slf op in any case, so pp_slf can skip it */ |
923 | /* and we have to provide the pp_slf op in any case, so pp_slf can skip it */ |
905 | coro_setup_op.op_next = PL_op; |
924 | coro_setup_op.op_next = PL_op; |
906 | coro_setup_op.op_type = OP_CUSTOM; |
925 | coro_setup_op.op_type = OP_ENTERSUB; |
907 | coro_setup_op.op_ppaddr = pp_slf; |
926 | coro_setup_op.op_ppaddr = pp_slf; |
908 | /* no flags etc. required, as an init function won't be called */ |
927 | /* no flags etc. required, as an init function won't be called */ |
909 | |
928 | |
910 | PL_op = (OP *)&coro_setup_op; |
929 | PL_op = (OP *)&coro_setup_op; |
911 | |
930 | |
… | |
… | |
937 | SvREFCNT_dec (GvAV (PL_defgv)); |
956 | SvREFCNT_dec (GvAV (PL_defgv)); |
938 | SvREFCNT_dec (GvSV (PL_errgv)); |
957 | SvREFCNT_dec (GvSV (PL_errgv)); |
939 | SvREFCNT_dec (PL_defoutgv); |
958 | SvREFCNT_dec (PL_defoutgv); |
940 | SvREFCNT_dec (PL_rs); |
959 | SvREFCNT_dec (PL_rs); |
941 | SvREFCNT_dec (GvSV (irsgv)); |
960 | SvREFCNT_dec (GvSV (irsgv)); |
|
|
961 | SvREFCNT_dec (GvHV (PL_hintgv)); |
942 | |
962 | |
943 | SvREFCNT_dec (PL_diehook); |
963 | SvREFCNT_dec (PL_diehook); |
944 | SvREFCNT_dec (PL_warnhook); |
964 | SvREFCNT_dec (PL_warnhook); |
945 | |
965 | |
946 | SvREFCNT_dec (coro->saved_deffh); |
966 | SvREFCNT_dec (coro->saved_deffh); |
… | |
… | |
964 | static int |
984 | static int |
965 | runops_trace (pTHX) |
985 | runops_trace (pTHX) |
966 | { |
986 | { |
967 | COP *oldcop = 0; |
987 | COP *oldcop = 0; |
968 | int oldcxix = -2; |
988 | int oldcxix = -2; |
969 | struct coro *coro = SvSTATE_current; /* trace cctx is tied to specific coro */ |
|
|
970 | coro_cctx *cctx = coro->cctx; |
|
|
971 | |
989 | |
972 | while ((PL_op = CALL_FPTR (PL_op->op_ppaddr) (aTHX))) |
990 | while ((PL_op = CALL_FPTR (PL_op->op_ppaddr) (aTHX))) |
973 | { |
991 | { |
974 | PERL_ASYNC_CHECK (); |
992 | PERL_ASYNC_CHECK (); |
975 | |
993 | |
976 | if (cctx->flags & CC_TRACE_ALL) |
994 | if (cctx_current->flags & CC_TRACE_ALL) |
977 | { |
995 | { |
978 | if (PL_op->op_type == OP_LEAVESUB && cctx->flags & CC_TRACE_SUB) |
996 | if (PL_op->op_type == OP_LEAVESUB && cctx_current->flags & CC_TRACE_SUB) |
979 | { |
997 | { |
980 | PERL_CONTEXT *cx = &cxstack[cxstack_ix]; |
998 | PERL_CONTEXT *cx = &cxstack[cxstack_ix]; |
981 | SV **bot, **top; |
999 | SV **bot, **top; |
982 | AV *av = newAV (); /* return values */ |
1000 | AV *av = newAV (); /* return values */ |
983 | SV **cb; |
1001 | SV **cb; |
… | |
… | |
1020 | |
1038 | |
1021 | if (PL_curcop != &PL_compiling) |
1039 | if (PL_curcop != &PL_compiling) |
1022 | { |
1040 | { |
1023 | SV **cb; |
1041 | SV **cb; |
1024 | |
1042 | |
1025 | if (oldcxix != cxstack_ix && cctx->flags & CC_TRACE_SUB) |
1043 | if (oldcxix != cxstack_ix && cctx_current->flags & CC_TRACE_SUB) |
1026 | { |
1044 | { |
1027 | PERL_CONTEXT *cx = &cxstack[cxstack_ix]; |
1045 | PERL_CONTEXT *cx = &cxstack[cxstack_ix]; |
1028 | |
1046 | |
1029 | if (CxTYPE (cx) == CXt_SUB && oldcxix < cxstack_ix) |
1047 | if (CxTYPE (cx) == CXt_SUB && oldcxix < cxstack_ix) |
1030 | { |
1048 | { |
1031 | runops_proc_t old_runops = PL_runops; |
|
|
1032 | dSP; |
1049 | dSP; |
1033 | GV *gv = CvGV (cx->blk_sub.cv); |
1050 | GV *gv = CvGV (cx->blk_sub.cv); |
1034 | SV *fullname = sv_2mortal (newSV (0)); |
1051 | SV *fullname = sv_2mortal (newSV (0)); |
1035 | |
1052 | |
1036 | if (isGV (gv)) |
1053 | if (isGV (gv)) |
… | |
… | |
1054 | } |
1071 | } |
1055 | |
1072 | |
1056 | oldcxix = cxstack_ix; |
1073 | oldcxix = cxstack_ix; |
1057 | } |
1074 | } |
1058 | |
1075 | |
1059 | if (cctx->flags & CC_TRACE_LINE) |
1076 | if (cctx_current->flags & CC_TRACE_LINE) |
1060 | { |
1077 | { |
1061 | dSP; |
1078 | dSP; |
1062 | |
1079 | |
1063 | PL_runops = RUNOPS_DEFAULT; |
1080 | PL_runops = RUNOPS_DEFAULT; |
1064 | ENTER; |
1081 | ENTER; |
… | |
… | |
1083 | |
1100 | |
1084 | TAINT_NOT; |
1101 | TAINT_NOT; |
1085 | return 0; |
1102 | return 0; |
1086 | } |
1103 | } |
1087 | |
1104 | |
1088 | static struct coro_cctx *cctx_ssl_cctx; |
|
|
1089 | static struct CoroSLF cctx_ssl_frame; |
1105 | static struct CoroSLF cctx_ssl_frame; |
1090 | |
1106 | |
1091 | static void |
1107 | static void |
1092 | slf_prepare_set_stacklevel (pTHX_ struct coro_transfer_args *ta) |
1108 | slf_prepare_set_stacklevel (pTHX_ struct coro_transfer_args *ta) |
1093 | { |
1109 | { |
1094 | ta->prev = (struct coro *)cctx_ssl_cctx; |
|
|
1095 | ta->next = 0; |
1110 | ta->prev = 0; |
1096 | } |
1111 | } |
1097 | |
1112 | |
1098 | static int |
1113 | static int |
1099 | slf_check_set_stacklevel (pTHX_ struct CoroSLF *frame) |
1114 | slf_check_set_stacklevel (pTHX_ struct CoroSLF *frame) |
1100 | { |
1115 | { |
… | |
… | |
1103 | return frame->check (aTHX_ frame); /* execute the restored frame - there must be one */ |
1118 | return frame->check (aTHX_ frame); /* execute the restored frame - there must be one */ |
1104 | } |
1119 | } |
1105 | |
1120 | |
1106 | /* initialises PL_top_env and injects a pseudo-slf-call to set the stacklevel */ |
1121 | /* initialises PL_top_env and injects a pseudo-slf-call to set the stacklevel */ |
1107 | static void NOINLINE |
1122 | static void NOINLINE |
1108 | cctx_prepare (pTHX_ coro_cctx *cctx) |
1123 | cctx_prepare (pTHX) |
1109 | { |
1124 | { |
1110 | PL_top_env = &PL_start_env; |
1125 | PL_top_env = &PL_start_env; |
1111 | |
1126 | |
1112 | if (cctx->flags & CC_TRACE) |
1127 | if (cctx_current->flags & CC_TRACE) |
1113 | PL_runops = runops_trace; |
1128 | PL_runops = runops_trace; |
1114 | |
1129 | |
1115 | /* we already must be executing an SLF op, there is no other valid way |
1130 | /* we already must be executing an SLF op, there is no other valid way |
1116 | * that can lead to creation of a new cctx */ |
1131 | * that can lead to creation of a new cctx */ |
1117 | assert (("FATAL: can't prepare slf-less cctx in Coro module (please report)", |
1132 | assert (("FATAL: can't prepare slf-less cctx in Coro module (please report)", |
1118 | slf_frame.prepare && PL_op->op_ppaddr == pp_slf)); |
1133 | slf_frame.prepare && PL_op->op_ppaddr == pp_slf)); |
1119 | |
1134 | |
1120 | /* we must emulate leaving pp_slf, which is done inside slf_check_set_stacklevel */ |
1135 | /* we must emulate leaving pp_slf, which is done inside slf_check_set_stacklevel */ |
1121 | cctx_ssl_cctx = cctx; |
|
|
1122 | cctx_ssl_frame = slf_frame; |
1136 | cctx_ssl_frame = slf_frame; |
1123 | |
1137 | |
1124 | slf_frame.prepare = slf_prepare_set_stacklevel; |
1138 | slf_frame.prepare = slf_prepare_set_stacklevel; |
1125 | slf_frame.check = slf_check_set_stacklevel; |
1139 | slf_frame.check = slf_check_set_stacklevel; |
1126 | } |
1140 | } |
… | |
… | |
1149 | /* normally we would need to skip the entersub here */ |
1163 | /* normally we would need to skip the entersub here */ |
1150 | /* not doing so will re-execute it, which is exactly what we want */ |
1164 | /* not doing so will re-execute it, which is exactly what we want */ |
1151 | /* PL_nop = PL_nop->op_next */ |
1165 | /* PL_nop = PL_nop->op_next */ |
1152 | |
1166 | |
1153 | /* inject a fake subroutine call to cctx_init */ |
1167 | /* inject a fake subroutine call to cctx_init */ |
1154 | cctx_prepare (aTHX_ (coro_cctx *)arg); |
1168 | cctx_prepare (aTHX); |
1155 | |
1169 | |
1156 | /* cctx_run is the alternative tail of transfer() */ |
1170 | /* cctx_run is the alternative tail of transfer() */ |
1157 | transfer_tail (aTHX); |
1171 | transfer_tail (aTHX); |
1158 | |
1172 | |
1159 | /* somebody or something will hit me for both perl_run and PL_restartop */ |
1173 | /* somebody or something will hit me for both perl_run and PL_restartop */ |
… | |
… | |
1167 | /* |
1181 | /* |
1168 | * If perl-run returns we assume exit() was being called or the coro |
1182 | * If perl-run returns we assume exit() was being called or the coro |
1169 | * fell off the end, which seems to be the only valid (non-bug) |
1183 | * fell off the end, which seems to be the only valid (non-bug) |
1170 | * reason for perl_run to return. We try to exit by jumping to the |
1184 | * reason for perl_run to return. We try to exit by jumping to the |
1171 | * bootstrap-time "top" top_env, as we cannot restore the "main" |
1185 | * bootstrap-time "top" top_env, as we cannot restore the "main" |
1172 | * coroutine as Coro has no such concept |
1186 | * coroutine as Coro has no such concept. |
|
|
1187 | * This actually isn't valid with the pthread backend, but OSes requiring |
|
|
1188 | * that backend are too broken to do it in a standards-compliant way. |
1173 | */ |
1189 | */ |
1174 | PL_top_env = main_top_env; |
1190 | PL_top_env = main_top_env; |
1175 | JMPENV_JUMP (2); /* I do not feel well about the hardcoded 2 at all */ |
1191 | JMPENV_JUMP (2); /* I do not feel well about the hardcoded 2 at all */ |
1176 | } |
1192 | } |
1177 | } |
1193 | } |
… | |
… | |
1254 | cctx_destroy (coro_cctx *cctx) |
1270 | cctx_destroy (coro_cctx *cctx) |
1255 | { |
1271 | { |
1256 | if (!cctx) |
1272 | if (!cctx) |
1257 | return; |
1273 | return; |
1258 | |
1274 | |
|
|
1275 | assert (cctx != cctx_current);//D temporary |
|
|
1276 | |
1259 | --cctx_count; |
1277 | --cctx_count; |
1260 | coro_destroy (&cctx->cctx); |
1278 | coro_destroy (&cctx->cctx); |
1261 | |
1279 | |
1262 | /* coro_transfer creates new, empty cctx's */ |
1280 | /* coro_transfer creates new, empty cctx's */ |
1263 | if (cctx->sptr) |
1281 | if (cctx->sptr) |
… | |
… | |
1326 | /* TODO: throwing up here is considered harmful */ |
1344 | /* TODO: throwing up here is considered harmful */ |
1327 | |
1345 | |
1328 | if (expect_true (prev != next)) |
1346 | if (expect_true (prev != next)) |
1329 | { |
1347 | { |
1330 | if (expect_false (!(prev->flags & (CF_RUNNING | CF_NEW)))) |
1348 | if (expect_false (!(prev->flags & (CF_RUNNING | CF_NEW)))) |
1331 | croak ("Coro::State::transfer called with non-running/new prev Coro::State, but can only transfer from running or new states,"); |
1349 | croak ("Coro::State::transfer called with a suspended prev Coro::State, but can only transfer from running or new states,"); |
1332 | |
1350 | |
1333 | if (expect_false (next->flags & CF_RUNNING)) |
1351 | if (expect_false (next->flags & CF_RUNNING)) |
1334 | croak ("Coro::State::transfer called with running next Coro::State, but can only transfer to inactive states,"); |
1352 | croak ("Coro::State::transfer called with running next Coro::State, but can only transfer to inactive states,"); |
1335 | |
1353 | |
1336 | if (expect_false (next->flags & CF_DESTROYED)) |
1354 | if (expect_false (next->flags & CF_DESTROYED)) |
… | |
… | |
1348 | transfer (pTHX_ struct coro *prev, struct coro *next, int force_cctx) |
1366 | transfer (pTHX_ struct coro *prev, struct coro *next, int force_cctx) |
1349 | { |
1367 | { |
1350 | dSTACKLEVEL; |
1368 | dSTACKLEVEL; |
1351 | |
1369 | |
1352 | /* sometimes transfer is only called to set idle_sp */ |
1370 | /* sometimes transfer is only called to set idle_sp */ |
1353 | if (expect_false (!next)) |
1371 | if (expect_false (!prev)) |
1354 | { |
1372 | { |
1355 | ((coro_cctx *)prev)->idle_sp = STACKLEVEL; |
1373 | cctx_current->idle_sp = STACKLEVEL; |
1356 | assert (((coro_cctx *)prev)->idle_te = PL_top_env); /* just for the side-effect when asserts are enabled */ |
1374 | assert (cctx_current->idle_te = PL_top_env); /* just for the side-effect when asserts are enabled */ |
1357 | } |
1375 | } |
1358 | else if (expect_true (prev != next)) |
1376 | else if (expect_true (prev != next)) |
1359 | { |
1377 | { |
1360 | coro_cctx *prev__cctx; |
1378 | coro_cctx *cctx_prev; |
1361 | |
1379 | |
1362 | if (expect_false (prev->flags & CF_NEW)) |
1380 | if (expect_false (prev->flags & CF_NEW)) |
1363 | { |
1381 | { |
1364 | /* create a new empty/source context */ |
1382 | /* create a new empty/source context */ |
1365 | prev->cctx = cctx_new_empty (); |
|
|
1366 | prev->flags &= ~CF_NEW; |
1383 | prev->flags &= ~CF_NEW; |
1367 | prev->flags |= CF_RUNNING; |
1384 | prev->flags |= CF_RUNNING; |
1368 | } |
1385 | } |
1369 | |
1386 | |
1370 | prev->flags &= ~CF_RUNNING; |
1387 | prev->flags &= ~CF_RUNNING; |
… | |
… | |
1381 | coro_setup (aTHX_ next); |
1398 | coro_setup (aTHX_ next); |
1382 | } |
1399 | } |
1383 | else |
1400 | else |
1384 | load_perl (aTHX_ next); |
1401 | load_perl (aTHX_ next); |
1385 | |
1402 | |
1386 | prev__cctx = prev->cctx; |
1403 | assert (!prev->cctx);//D temporary |
1387 | |
1404 | |
1388 | /* possibly untie and reuse the cctx */ |
1405 | /* possibly untie and reuse the cctx */ |
1389 | if (expect_true ( |
1406 | if (expect_true ( |
1390 | prev__cctx->idle_sp == STACKLEVEL |
1407 | cctx_current->idle_sp == STACKLEVEL |
1391 | && !(prev__cctx->flags & CC_TRACE) |
1408 | && !(cctx_current->flags & CC_TRACE) |
1392 | && !force_cctx |
1409 | && !force_cctx |
1393 | )) |
1410 | )) |
1394 | { |
1411 | { |
1395 | /* I assume that stacklevel is a stronger indicator than PL_top_env changes */ |
1412 | /* I assume that stacklevel is a stronger indicator than PL_top_env changes */ |
1396 | assert (("FATAL: current top_env must equal previous top_env in Coro (please report)", PL_top_env == prev__cctx->idle_te)); |
1413 | assert (("FATAL: current top_env must equal previous top_env in Coro (please report)", PL_top_env == cctx_current->idle_te)); |
1397 | |
1414 | |
1398 | prev->cctx = 0; |
|
|
1399 | |
|
|
1400 | /* if the cctx is about to be destroyed we need to make sure we won't see it in cctx_get */ |
1415 | /* if the cctx is about to be destroyed we need to make sure we won't see it in cctx_get. */ |
1401 | /* without this the next cctx_get might destroy the prev__cctx while still in use */ |
1416 | /* without this the next cctx_get might destroy the running cctx while still in use */ |
1402 | if (expect_false (CCTX_EXPIRED (prev__cctx))) |
1417 | if (expect_false (CCTX_EXPIRED (cctx_current))) |
1403 | if (!next->cctx) |
1418 | if (expect_true (!next->cctx)) |
1404 | next->cctx = cctx_get (aTHX); |
1419 | next->cctx = cctx_get (aTHX); |
1405 | |
1420 | |
1406 | cctx_put (prev__cctx); |
1421 | cctx_put (cctx_current); |
1407 | } |
1422 | } |
|
|
1423 | else |
|
|
1424 | prev->cctx = cctx_current; |
1408 | |
1425 | |
1409 | ++next->usecount; |
1426 | ++next->usecount; |
1410 | |
1427 | |
1411 | if (expect_true (!next->cctx)) |
1428 | cctx_prev = cctx_current; |
1412 | next->cctx = cctx_get (aTHX); |
1429 | cctx_current = expect_false (next->cctx) ? next->cctx : cctx_get (aTHX); |
1413 | |
1430 | |
1414 | if (expect_false (prev__cctx != next->cctx)) |
1431 | next->cctx = 0; |
|
|
1432 | |
|
|
1433 | if (expect_false (cctx_prev != cctx_current)) |
1415 | { |
1434 | { |
1416 | prev__cctx->top_env = PL_top_env; |
1435 | cctx_prev->top_env = PL_top_env; |
1417 | PL_top_env = next->cctx->top_env; |
1436 | PL_top_env = cctx_current->top_env; |
1418 | coro_transfer (&prev__cctx->cctx, &next->cctx->cctx); |
1437 | coro_transfer (&cctx_prev->cctx, &cctx_current->cctx); |
1419 | } |
1438 | } |
1420 | |
1439 | |
1421 | transfer_tail (aTHX); |
1440 | transfer_tail (aTHX); |
1422 | } |
1441 | } |
1423 | } |
1442 | } |
… | |
… | |
1578 | { |
1597 | { |
1579 | struct coro *coro; |
1598 | struct coro *coro; |
1580 | SV *sv_hook; |
1599 | SV *sv_hook; |
1581 | void (*xs_hook)(void); |
1600 | void (*xs_hook)(void); |
1582 | |
1601 | |
1583 | if (SvROK (coro_sv)) |
|
|
1584 | coro_sv = SvRV (coro_sv); |
|
|
1585 | |
|
|
1586 | coro = SvSTATE (coro_sv); |
1602 | coro = SvSTATE (coro_sv); |
1587 | |
1603 | |
1588 | if (coro->flags & CF_READY) |
1604 | if (coro->flags & CF_READY) |
1589 | return 0; |
1605 | return 0; |
1590 | |
1606 | |
… | |
… | |
1657 | else |
1673 | else |
1658 | { |
1674 | { |
1659 | next->flags &= ~CF_READY; |
1675 | next->flags &= ~CF_READY; |
1660 | --coro_nready; |
1676 | --coro_nready; |
1661 | |
1677 | |
1662 | return prepare_schedule_to (aTHX_ ta, next); |
1678 | prepare_schedule_to (aTHX_ ta, next); |
|
|
1679 | break; |
1663 | } |
1680 | } |
1664 | } |
1681 | } |
1665 | else |
1682 | else |
1666 | { |
1683 | { |
1667 | /* nothing to schedule: call the idle handler */ |
1684 | /* nothing to schedule: call the idle handler */ |
|
|
1685 | if (SvROK (sv_idle) |
|
|
1686 | && SvOBJECT (SvRV (sv_idle))) |
|
|
1687 | { |
|
|
1688 | ++coro_nready; /* hack so that api_ready doesn't invoke ready hook */ |
|
|
1689 | api_ready (aTHX_ SvRV (sv_idle)); |
|
|
1690 | --coro_nready; |
|
|
1691 | } |
|
|
1692 | else |
|
|
1693 | { |
1668 | dSP; |
1694 | dSP; |
1669 | |
1695 | |
1670 | ENTER; |
1696 | ENTER; |
1671 | SAVETMPS; |
1697 | SAVETMPS; |
1672 | |
1698 | |
1673 | PUSHMARK (SP); |
1699 | PUSHMARK (SP); |
1674 | PUTBACK; |
1700 | PUTBACK; |
1675 | call_sv (get_sv ("Coro::idle", FALSE), G_VOID | G_DISCARD); |
1701 | call_sv (sv_idle, G_VOID | G_DISCARD); |
1676 | |
1702 | |
1677 | FREETMPS; |
1703 | FREETMPS; |
1678 | LEAVE; |
1704 | LEAVE; |
|
|
1705 | } |
1679 | } |
1706 | } |
1680 | } |
1707 | } |
1681 | } |
1708 | } |
1682 | |
1709 | |
1683 | INLINE void |
1710 | INLINE void |
… | |
… | |
1754 | static void |
1781 | static void |
1755 | api_trace (pTHX_ SV *coro_sv, int flags) |
1782 | api_trace (pTHX_ SV *coro_sv, int flags) |
1756 | { |
1783 | { |
1757 | struct coro *coro = SvSTATE (coro_sv); |
1784 | struct coro *coro = SvSTATE (coro_sv); |
1758 | |
1785 | |
|
|
1786 | if (coro->flags & CF_RUNNING) |
|
|
1787 | croak ("cannot enable tracing on a running coroutine, caught"); |
|
|
1788 | |
1759 | if (flags & CC_TRACE) |
1789 | if (flags & CC_TRACE) |
1760 | { |
1790 | { |
1761 | if (!coro->cctx) |
1791 | if (!coro->cctx) |
1762 | coro->cctx = cctx_new_run (); |
1792 | coro->cctx = cctx_new_run (); |
1763 | else if (!(coro->cctx->flags & CC_TRACE)) |
1793 | else if (!(coro->cctx->flags & CC_TRACE)) |
1764 | croak ("cannot enable tracing on coroutine with custom stack,"); |
1794 | croak ("cannot enable tracing on coroutine with custom stack, caught"); |
1765 | |
1795 | |
1766 | coro->cctx->flags |= CC_NOREUSE | (flags & (CC_TRACE | CC_TRACE_ALL)); |
1796 | coro->cctx->flags |= CC_NOREUSE | (flags & (CC_TRACE | CC_TRACE_ALL)); |
1767 | } |
1797 | } |
1768 | else if (coro->cctx && coro->cctx->flags & CC_TRACE) |
1798 | else if (coro->cctx && coro->cctx->flags & CC_TRACE) |
1769 | { |
1799 | { |
… | |
… | |
2250 | } |
2280 | } |
2251 | else |
2281 | else |
2252 | slf_argc = 0; |
2282 | slf_argc = 0; |
2253 | |
2283 | |
2254 | PL_op->op_ppaddr = pp_slf; |
2284 | PL_op->op_ppaddr = pp_slf; |
2255 | PL_op->op_type = OP_CUSTOM; /* maybe we should leave it at entersub? */ |
2285 | /*PL_op->op_type = OP_CUSTOM; /* we do behave like entersub still */ |
2256 | |
2286 | |
2257 | PL_op = (OP *)&slf_restore; |
2287 | PL_op = (OP *)&slf_restore; |
2258 | } |
2288 | } |
2259 | |
2289 | |
2260 | /*****************************************************************************/ |
2290 | /*****************************************************************************/ |
… | |
… | |
2343 | SV **ary; |
2373 | SV **ary; |
2344 | |
2374 | |
2345 | /* unfortunately, building manually saves memory */ |
2375 | /* unfortunately, building manually saves memory */ |
2346 | Newx (ary, 2, SV *); |
2376 | Newx (ary, 2, SV *); |
2347 | AvALLOC (av) = ary; |
2377 | AvALLOC (av) = ary; |
|
|
2378 | #if PERL_VERSION_ATLEAST (5,10,0) |
2348 | /*AvARRAY (av) = ary;*/ |
2379 | AvARRAY (av) = ary; |
|
|
2380 | #else |
2349 | SvPVX ((SV *)av) = (char *)ary; /* 5.8.8 needs this syntax instead of AvARRAY = ary */ |
2381 | /* 5.8.8 needs this syntax instead of AvARRAY = ary, yet */ |
|
|
2382 | /* -DDEBUGGING flags this as a bug, despite it perfectly working */ |
|
|
2383 | SvPVX ((SV *)av) = (char *)ary; |
|
|
2384 | #endif |
2350 | AvMAX (av) = 1; |
2385 | AvMAX (av) = 1; |
2351 | AvFILLp (av) = 0; |
2386 | AvFILLp (av) = 0; |
2352 | ary [0] = newSViv (count); |
2387 | ary [0] = newSViv (count); |
2353 | |
2388 | |
2354 | return newRV_noinc ((SV *)av); |
2389 | return newRV_noinc ((SV *)av); |
… | |
… | |
2724 | XSRETURN_EMPTY; |
2759 | XSRETURN_EMPTY; |
2725 | } |
2760 | } |
2726 | |
2761 | |
2727 | /*****************************************************************************/ |
2762 | /*****************************************************************************/ |
2728 | |
2763 | |
|
|
2764 | #if CORO_CLONE |
|
|
2765 | # include "clone.c" |
|
|
2766 | #endif |
|
|
2767 | |
2729 | MODULE = Coro::State PACKAGE = Coro::State PREFIX = api_ |
2768 | MODULE = Coro::State PACKAGE = Coro::State PREFIX = api_ |
2730 | |
2769 | |
2731 | PROTOTYPES: DISABLE |
2770 | PROTOTYPES: DISABLE |
2732 | |
2771 | |
2733 | BOOT: |
2772 | BOOT: |
… | |
… | |
2737 | coro_thx = PERL_GET_CONTEXT; |
2776 | coro_thx = PERL_GET_CONTEXT; |
2738 | # endif |
2777 | # endif |
2739 | #endif |
2778 | #endif |
2740 | BOOT_PAGESIZE; |
2779 | BOOT_PAGESIZE; |
2741 | |
2780 | |
|
|
2781 | cctx_current = cctx_new_empty (); |
|
|
2782 | |
2742 | irsgv = gv_fetchpv ("/" , GV_ADD|GV_NOTQUAL, SVt_PV); |
2783 | irsgv = gv_fetchpv ("/" , GV_ADD|GV_NOTQUAL, SVt_PV); |
2743 | stdoutgv = gv_fetchpv ("STDOUT", GV_ADD|GV_NOTQUAL, SVt_PVIO); |
2784 | stdoutgv = gv_fetchpv ("STDOUT", GV_ADD|GV_NOTQUAL, SVt_PVIO); |
2744 | |
2785 | |
2745 | orig_sigelem_get = PL_vtbl_sigelem.svt_get; PL_vtbl_sigelem.svt_get = coro_sigelem_get; |
2786 | orig_sigelem_get = PL_vtbl_sigelem.svt_get; PL_vtbl_sigelem.svt_get = coro_sigelem_get; |
2746 | orig_sigelem_set = PL_vtbl_sigelem.svt_set; PL_vtbl_sigelem.svt_set = coro_sigelem_set; |
2787 | orig_sigelem_set = PL_vtbl_sigelem.svt_set; PL_vtbl_sigelem.svt_set = coro_sigelem_set; |
… | |
… | |
2765 | |
2806 | |
2766 | { |
2807 | { |
2767 | SV *slf = sv_2mortal (newSViv (PTR2IV (pp_slf))); |
2808 | SV *slf = sv_2mortal (newSViv (PTR2IV (pp_slf))); |
2768 | |
2809 | |
2769 | if (!PL_custom_op_names) PL_custom_op_names = newHV (); |
2810 | if (!PL_custom_op_names) PL_custom_op_names = newHV (); |
2770 | hv_store_ent (PL_custom_op_names, slf, |
2811 | hv_store_ent (PL_custom_op_names, slf, newSVpv ("coro_slf", 0), 0); |
2771 | newSVpv ("coro_slf", 0), 0); |
|
|
2772 | |
2812 | |
2773 | if (!PL_custom_op_descs) PL_custom_op_descs = newHV (); |
2813 | if (!PL_custom_op_descs) PL_custom_op_descs = newHV (); |
2774 | hv_store_ent (PL_custom_op_descs, slf, |
2814 | hv_store_ent (PL_custom_op_descs, slf, newSVpv ("coro schedule like function", 0), 0); |
2775 | newSVpv ("coro schedule like function", 0), 0); |
|
|
2776 | } |
2815 | } |
2777 | |
2816 | |
2778 | coroapi.ver = CORO_API_VERSION; |
2817 | coroapi.ver = CORO_API_VERSION; |
2779 | coroapi.rev = CORO_API_REVISION; |
2818 | coroapi.rev = CORO_API_REVISION; |
2780 | |
2819 | |
… | |
… | |
2873 | void |
2912 | void |
2874 | _exit (int code) |
2913 | _exit (int code) |
2875 | PROTOTYPE: $ |
2914 | PROTOTYPE: $ |
2876 | CODE: |
2915 | CODE: |
2877 | _exit (code); |
2916 | _exit (code); |
|
|
2917 | |
|
|
2918 | SV * |
|
|
2919 | clone (Coro::State coro) |
|
|
2920 | CODE: |
|
|
2921 | { |
|
|
2922 | #if CORO_CLONE |
|
|
2923 | struct coro *ncoro = coro_clone (coro); |
|
|
2924 | MAGIC *mg; |
|
|
2925 | /* TODO: too much duplication */ |
|
|
2926 | ncoro->hv = newHV (); |
|
|
2927 | mg = sv_magicext ((SV *)ncoro->hv, 0, CORO_MAGIC_type_state, &coro_state_vtbl, (char *)ncoro, 0); |
|
|
2928 | mg->mg_flags |= MGf_DUP; |
|
|
2929 | RETVAL = sv_bless (newRV_noinc ((SV *)ncoro->hv), SvSTASH (coro->hv)); |
|
|
2930 | #else |
|
|
2931 | croak ("Coro::State->clone has not been configured into this installation of Coro, realised"); |
|
|
2932 | #endif |
|
|
2933 | } |
|
|
2934 | OUTPUT: |
|
|
2935 | RETVAL |
2878 | |
2936 | |
2879 | int |
2937 | int |
2880 | cctx_stacksize (int new_stacksize = 0) |
2938 | cctx_stacksize (int new_stacksize = 0) |
2881 | PROTOTYPE: ;$ |
2939 | PROTOTYPE: ;$ |
2882 | CODE: |
2940 | CODE: |
… | |
… | |
3003 | |
3061 | |
3004 | SV * |
3062 | SV * |
3005 | has_cctx (Coro::State coro) |
3063 | has_cctx (Coro::State coro) |
3006 | PROTOTYPE: $ |
3064 | PROTOTYPE: $ |
3007 | CODE: |
3065 | CODE: |
3008 | RETVAL = boolSV (!!coro->cctx); |
3066 | /* maybe manage the running flag differently */ |
|
|
3067 | RETVAL = boolSV (!!coro->cctx || (coro->flags & CF_RUNNING)); |
3009 | OUTPUT: |
3068 | OUTPUT: |
3010 | RETVAL |
3069 | RETVAL |
3011 | |
3070 | |
3012 | int |
3071 | int |
3013 | is_traced (Coro::State coro) |
3072 | is_traced (Coro::State coro) |
… | |
… | |
3033 | |
3092 | |
3034 | void |
3093 | void |
3035 | force_cctx () |
3094 | force_cctx () |
3036 | PROTOTYPE: |
3095 | PROTOTYPE: |
3037 | CODE: |
3096 | CODE: |
3038 | SvSTATE_current->cctx->idle_sp = 0; |
3097 | cctx_current->idle_sp = 0; |
3039 | |
3098 | |
3040 | void |
3099 | void |
3041 | swap_defsv (Coro::State self) |
3100 | swap_defsv (Coro::State self) |
3042 | PROTOTYPE: $ |
3101 | PROTOTYPE: $ |
3043 | ALIAS: |
3102 | ALIAS: |
… | |
… | |
3066 | cv_coro_terminate = get_cv ( "Coro::terminate" , GV_ADD); |
3125 | cv_coro_terminate = get_cv ( "Coro::terminate" , GV_ADD); |
3067 | coro_current = coro_get_sv (aTHX_ "Coro::current" , FALSE); SvREADONLY_on (coro_current); |
3126 | coro_current = coro_get_sv (aTHX_ "Coro::current" , FALSE); SvREADONLY_on (coro_current); |
3068 | av_async_pool = coro_get_av (aTHX_ "Coro::async_pool", TRUE); |
3127 | av_async_pool = coro_get_av (aTHX_ "Coro::async_pool", TRUE); |
3069 | av_destroy = coro_get_av (aTHX_ "Coro::destroy" , TRUE); |
3128 | av_destroy = coro_get_av (aTHX_ "Coro::destroy" , TRUE); |
3070 | sv_manager = coro_get_sv (aTHX_ "Coro::manager" , TRUE); |
3129 | sv_manager = coro_get_sv (aTHX_ "Coro::manager" , TRUE); |
|
|
3130 | sv_idle = coro_get_sv (aTHX_ "Coro::idle" , TRUE); |
3071 | |
3131 | |
3072 | sv_async_pool_idle = newSVpv ("[async pool idle]", 0); SvREADONLY_on (sv_async_pool_idle); |
3132 | sv_async_pool_idle = newSVpv ("[async pool idle]", 0); SvREADONLY_on (sv_async_pool_idle); |
3073 | sv_Coro = newSVpv ("Coro", 0); SvREADONLY_on (sv_Coro); |
3133 | sv_Coro = newSVpv ("Coro", 0); SvREADONLY_on (sv_Coro); |
3074 | cv_pool_handler = get_cv ("Coro::pool_handler", GV_ADD); SvREADONLY_on (cv_pool_handler); |
3134 | cv_pool_handler = get_cv ("Coro::pool_handler", GV_ADD); SvREADONLY_on (cv_pool_handler); |
3075 | cv_coro_state_new = get_cv ("Coro::State::new", 0); SvREADONLY_on (cv_coro_state_new); |
3135 | cv_coro_state_new = get_cv ("Coro::State::new", 0); SvREADONLY_on (cv_coro_state_new); |