X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Upper.xs;h=550340125987df59e0482a42b16ba63c0842bebf;hb=ca164d41378dca4c016f1b7f1a92bf0730ee3572;hp=6ff176d68d913973734a80e8bde1d18b85eec2eb;hpb=915ea103e7467eb15f3e5a37c4d4329a2803ea3a;p=perl%2Fmodules%2FScope-Upper.git diff --git a/Upper.xs b/Upper.xs index 6ff176d..5503401 100644 --- a/Upper.xs +++ b/Upper.xs @@ -1050,6 +1050,8 @@ static const char *su_block_type[] = { #define SU_CXNAME(C) SU_CX_TYPENAME(CxTYPE(C)) +#if XSH_DEBUG + /* for debugging. These indicate how many ENTERs each context type * does before the PUSHBLOCK */ @@ -1069,9 +1071,12 @@ static const int su_cxt_enter_count[] = { # endif }; +#endif /* XSH_DEBUG */ + /* push at least 'size' slots worth of padding onto the savestack */ static void su_ss_push_padding(pTHX_ void *ud, I32 size) { +#define su_ss_push_padding(U, S) su_ss_push_padding(aTHX_ (U), (S)) if (size <= 0) return; if (size < SU_SAVE_ALLOC_SIZE + 1) /* minimum possible SAVEt_ALLOC */ @@ -1088,11 +1093,11 @@ static void su_pop(pTHX_ void *ud); * first indicates that this is the first push of a destructor */ static void su_ss_push_destructor(pTHX_ void *ud, I32 depth, bool first) { +#define su_ss_push_destructor(U, D, F) su_ss_push_destructor(aTHX_ (U), (D), (F)) su_ud_origin_elem *origin = SU_UD_ORIGIN(ud); - I32 pad; assert(first || origin[depth+1].orig_ix == PL_savestack_ix); - su_ss_push_padding(aTHX_ ud, + su_ss_push_padding(ud, (origin[depth].orig_ix + origin[depth].offset) - PL_savestack_ix); XSH_D(su_debug_log( "%p: push destructor at save_ix=%d depth=%d scope_ix=%d\n", @@ -1130,7 +1135,7 @@ static void su_pop(pTHX_ void *ud) { SU_UD_DEPTH(ud) = depth; if (depth > 0) { - su_ss_push_destructor(aTHX_ ud, depth-1, 0); + su_ss_push_destructor(ud, depth-1, 0); } else { I32 offset = origin[0].offset; /* grab value before origin is freed */ switch (SU_UD_TYPE(ud)) { @@ -1154,7 +1159,7 @@ static void su_pop(pTHX_ void *ud) { if (PL_savestack_ix < base + offset) { I32 gap = (base + offset) - PL_savestack_ix; assert(gap >= SU_SAVE_ALLOC_SIZE + 1); - su_ss_push_padding(aTHX_ ud, gap); + su_ss_push_padding(ud, gap); } assert(PL_savestack_ix == base + offset); } @@ -1166,7 +1171,7 @@ static void su_pop(pTHX_ void *ud) { static void su_init(pTHX_ void *ud, I32 cxix, I32 size) { #define su_init(U, C, S) su_init(aTHX_ (U), (C), (S)) - I32 i, depth, base; + I32 i, depth; su_ud_origin_elem *origin; I32 cur_cx_ix; I32 cur_scope_ix; @@ -1319,7 +1324,7 @@ static void su_init(pTHX_ void *ud, I32 cxix, I32 size) { SU_UD_DEPTH(ud) = depth; SU_UD_ORIGIN(ud) = origin; - su_ss_push_destructor(aTHX_ ud, depth-1, 1); + su_ss_push_destructor(ud, depth-1, 1); } /* --- Unwind stack -------------------------------------------------------- */ @@ -2017,6 +2022,7 @@ static int su_uplevel_runops_hook_entersub(pTHX) { } static I32 su_uplevel_new(pTHX_ CV *callback, I32 cxix, I32 args) { +#define su_uplevel_new(CB, CX, A) su_uplevel_new(aTHX_ (CB), (CX), (A)) su_uplevel_ud *sud; U8 *saved_cxtypes; I32 i, ret; @@ -2086,6 +2092,7 @@ static I32 su_uplevel_new(pTHX_ CV *callback, I32 cxix, I32 args) { #else static I32 su_uplevel_old(pTHX_ CV *callback, I32 cxix, I32 args) { +#define su_uplevel_old(CB, CX, A) su_uplevel_old(aTHX_ (CB), (CX), (A)) su_uplevel_ud *sud; const PERL_CONTEXT *cx = cxstack + cxix; PERL_SI *si; @@ -3244,9 +3251,9 @@ PPCODE: } /* su_uplevel() takes care of extending the stack if needed. */ #if SU_HAS_NEW_CXT - ret = su_uplevel_new(aTHX_ (CV *) code, cxix, args); + ret = su_uplevel_new((CV *) code, cxix, args); #else - ret = su_uplevel_old(aTHX_ (CV *) code, cxix, args); + ret = su_uplevel_old((CV *) code, cxix, args); #endif XSRETURN(ret); default: