… | |
… | |
88 | /* prefer perl internal functions over our own? */ |
88 | /* prefer perl internal functions over our own? */ |
89 | #ifndef CORO_PREFER_PERL_FUNCTIONS |
89 | #ifndef CORO_PREFER_PERL_FUNCTIONS |
90 | # define CORO_PREFER_PERL_FUNCTIONS 0 |
90 | # define CORO_PREFER_PERL_FUNCTIONS 0 |
91 | #endif |
91 | #endif |
92 | |
92 | |
93 | /* The next macro should declare a variable stacklevel that contains and approximation |
93 | /* The next macros try to return the current stack pointer, in an as |
94 | * to the current C stack pointer. Its property is that it changes with each call |
94 | * portable way as possible. */ |
95 | * and should be unique. */ |
|
|
96 | #define dSTACKLEVEL int stacklevel |
95 | #define dSTACKLEVEL volatile char stacklevel |
97 | #define STACKLEVEL ((void *)&stacklevel) |
96 | #define STACKLEVEL ((void *)&stacklevel) |
98 | |
97 | |
99 | #define IN_DESTRUCT (PL_main_cv == Nullcv) |
98 | #define IN_DESTRUCT (PL_main_cv == Nullcv) |
100 | |
99 | |
101 | #if __GNUC__ >= 3 |
100 | #if __GNUC__ >= 3 |
… | |
… | |
395 | /* |
394 | /* |
396 | * the worst thing you can imagine happens first - we have to save |
395 | * the worst thing you can imagine happens first - we have to save |
397 | * (and reinitialize) all cv's in the whole callchain :( |
396 | * (and reinitialize) all cv's in the whole callchain :( |
398 | */ |
397 | */ |
399 | |
398 | |
400 | EXTEND (SP, 3 + 1); |
|
|
401 | PUSHs (Nullsv); |
399 | XPUSHs (Nullsv); |
402 | /* this loop was inspired by pp_caller */ |
400 | /* this loop was inspired by pp_caller */ |
403 | for (;;) |
401 | for (;;) |
404 | { |
402 | { |
405 | while (cxix >= 0) |
403 | while (cxix >= 0) |
406 | { |
404 | { |
… | |
… | |
425 | |
423 | |
426 | if (top_si->si_type == PERLSI_MAIN) |
424 | if (top_si->si_type == PERLSI_MAIN) |
427 | break; |
425 | break; |
428 | |
426 | |
429 | top_si = top_si->si_prev; |
427 | top_si = top_si->si_prev; |
430 | ccstk = top_si->si_cxstack; |
428 | ccstk = top_si->si_cxstack; |
431 | cxix = top_si->si_cxix; |
429 | cxix = top_si->si_cxix; |
432 | } |
430 | } |
433 | |
431 | |
434 | PUTBACK; |
432 | PUTBACK; |
435 | } |
433 | } |
436 | |
434 | |
… | |
… | |
455 | # define coro_init_stacks init_stacks |
453 | # define coro_init_stacks init_stacks |
456 | #else |
454 | #else |
457 | static void |
455 | static void |
458 | coro_init_stacks (pTHX) |
456 | coro_init_stacks (pTHX) |
459 | { |
457 | { |
460 | PL_curstackinfo = new_stackinfo(64, 4); |
458 | PL_curstackinfo = new_stackinfo(64, 6); |
461 | PL_curstackinfo->si_type = PERLSI_MAIN; |
459 | PL_curstackinfo->si_type = PERLSI_MAIN; |
462 | PL_curstack = PL_curstackinfo->si_stack; |
460 | PL_curstack = PL_curstackinfo->si_stack; |
463 | PL_mainstack = PL_curstack; /* remember in case we switch stacks */ |
461 | PL_mainstack = PL_curstack; /* remember in case we switch stacks */ |
464 | |
462 | |
465 | PL_stack_base = AvARRAY(PL_curstack); |
463 | PL_stack_base = AvARRAY(PL_curstack); |
… | |
… | |
486 | New(54,PL_savestack,64,ANY); |
484 | New(54,PL_savestack,64,ANY); |
487 | PL_savestack_ix = 0; |
485 | PL_savestack_ix = 0; |
488 | PL_savestack_max = 64; |
486 | PL_savestack_max = 64; |
489 | |
487 | |
490 | #if !PERL_VERSION_ATLEAST (5,9,0) |
488 | #if !PERL_VERSION_ATLEAST (5,9,0) |
491 | New(54,PL_retstack,8,OP*); |
489 | New(54,PL_retstack,4,OP*); |
492 | PL_retstack_ix = 0; |
490 | PL_retstack_ix = 0; |
493 | PL_retstack_max = 8; |
491 | PL_retstack_max = 4; |
494 | #endif |
492 | #endif |
495 | } |
493 | } |
496 | #endif |
494 | #endif |
497 | |
495 | |
498 | /* |
496 | /* |