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.466 by root, Sat Jun 25 19:22:33 2016 UTC vs.
Revision 1.472 by root, Thu Aug 31 16:24:19 2017 UTC

116# define CORO_CLOCK_MONOTONIC 1 116# define CORO_CLOCK_MONOTONIC 1
117# define CORO_CLOCK_THREAD_CPUTIME_ID 3 117# define CORO_CLOCK_THREAD_CPUTIME_ID 3
118# endif 118# endif
119#endif 119#endif
120 120
121/* one off bugfix for perl 5.22 */
122#if PERL_VERSION_ATLEAST(5,22,0) && !PERL_VERSION_ATLEAST(5,24,0)
123# undef PadlistNAMES
124# define PadlistNAMES(pl) *((PADNAMELIST **)PadlistARRAY (pl))
125#endif
126
127#if PERL_VERSION_ATLEAST(5,24,0)
128# define SUB_ARGARRAY PL_curpad[0]
129#else
130# define SUB_ARGARRAY (SV *)cx->blk_sub.argarray
131#endif
132
121/* perl usually suppressed asserts. for debugging, we sometimes force it to be on */ 133/* perl usually suppresses asserts. for debugging, we sometimes force it to be on */
122#if 0 134#if 0
123# undef NDEBUG 135# undef NDEBUG
124# include <assert.h> 136# include <assert.h>
125#endif 137#endif
126 138
1410 SAVETMPS; 1422 SAVETMPS;
1411 EXTEND (SP, 3); 1423 EXTEND (SP, 3);
1412 PUSHMARK (SP); 1424 PUSHMARK (SP);
1413 PUSHs (&PL_sv_yes); 1425 PUSHs (&PL_sv_yes);
1414 PUSHs (fullname); 1426 PUSHs (fullname);
1415 PUSHs (CxHASARGS (cx) ? sv_2mortal (newRV_inc ((SV *)cx->blk_sub.argarray)) : &PL_sv_undef); 1427 PUSHs (CxHASARGS (cx) ? sv_2mortal (newRV_inc (SUB_ARGARRAY)) : &PL_sv_undef);
1416 PUTBACK; 1428 PUTBACK;
1417 cb = hv_fetch ((HV *)SvRV (coro_current), "_trace_sub_cb", sizeof ("_trace_sub_cb") - 1, 0); 1429 cb = hv_fetch ((HV *)SvRV (coro_current), "_trace_sub_cb", sizeof ("_trace_sub_cb") - 1, 0);
1418 if (cb) call_sv (*cb, G_KEEPERR | G_EVAL | G_VOID | G_DISCARD); 1430 if (cb) call_sv (*cb, G_KEEPERR | G_EVAL | G_VOID | G_DISCARD);
1419 SPAGAIN; 1431 SPAGAIN;
1420 FREETMPS; 1432 FREETMPS;
2360safe_cancel (pTHX_ struct coro *coro, SV **arg, int items) 2372safe_cancel (pTHX_ struct coro *coro, SV **arg, int items)
2361{ 2373{
2362 if (coro->cctx) 2374 if (coro->cctx)
2363 croak ("coro inside C callback, unable to cancel at this time, caught"); 2375 croak ("coro inside C callback, unable to cancel at this time, caught");
2364 2376
2365 if (coro->flags & CF_NEW) 2377 if (coro->flags & (CF_NEW | CF_ZOMBIE))
2366 { 2378 {
2367 coro_set_status (aTHX_ coro, arg, items); 2379 coro_set_status (aTHX_ coro, arg, items);
2368 coro_state_destroy (aTHX_ coro); 2380 coro_state_destroy (aTHX_ coro);
2369 } 2381 }
2370 else 2382 else
2439 av_clear (GvAV (PL_defgv)); 2451 av_clear (GvAV (PL_defgv));
2440 hv_store (hv, "desc", sizeof ("desc") - 1, SvREFCNT_inc_NN (sv_async_pool_idle), 0); 2452 hv_store (hv, "desc", sizeof ("desc") - 1, SvREFCNT_inc_NN (sv_async_pool_idle), 0);
2441 2453
2442 if (ecb_expect_false (coro->swap_sv)) 2454 if (ecb_expect_false (coro->swap_sv))
2443 { 2455 {
2444 swap_svs_leave (coro); 2456 SWAP_SVS_LEAVE (coro);
2445 SvREFCNT_dec_NN (coro->swap_sv); 2457 SvREFCNT_dec_NN (coro->swap_sv);
2446 coro->swap_sv = 0; 2458 coro->swap_sv = 0;
2447 } 2459 }
2448 2460
2449 coro->prio = 0; 2461 coro->prio = 0;
3585 3597
3586 map_len = load_len + save_len + 16; 3598 map_len = load_len + save_len + 16;
3587 3599
3588 map_base = mmap (0, map_len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 3600 map_base = mmap (0, map_len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
3589 3601
3602 if (map_base == (char *)MAP_FAILED)
3603 map_base = mmap (0, map_len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
3604
3590 assert (("Coro: unable to mmap jit code page, cannot continue.", map_base != (char *)MAP_FAILED)); 3605 assert (("Coro: unable to mmap jit code page, cannot continue.", map_base != (char *)MAP_FAILED));
3591 3606
3592 load_perl_slots = (load_save_perl_slots_type)map_base; 3607 load_perl_slots = (load_save_perl_slots_type)map_base;
3593 memcpy (map_base, load_ptr, load_len); 3608 memcpy (map_base, load_ptr, load_len);
3594 3609
4064 coroapi.enterleave_hook = api_enterleave_hook; 4079 coroapi.enterleave_hook = api_enterleave_hook;
4065 coroapi.enterleave_unhook = api_enterleave_unhook; 4080 coroapi.enterleave_unhook = api_enterleave_unhook;
4066 coroapi.enterleave_scope_hook = api_enterleave_scope_hook; 4081 coroapi.enterleave_scope_hook = api_enterleave_scope_hook;
4067 4082
4068 /*GCoroAPI = &coroapi;*/ 4083 /*GCoroAPI = &coroapi;*/
4069 sv_setiv (sv, (IV)&coroapi); 4084 sv_setiv (sv, PTR2IV (&coroapi));
4070 SvREADONLY_on (sv); 4085 SvREADONLY_on (sv);
4071 } 4086 }
4072} 4087}
4073 4088
4074SV * 4089SV *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines