Change 27671 by [EMAIL PROTECTED] on 2006/04/02 10:08:04 Abstract all the accesses to cop_arybase (apart from ByteLoader)
Affected files ... ... //depot/perl/cop.h#112 edit ... //depot/perl/ext/B/B.xs#112 edit ... //depot/perl/mg.c#426 edit ... //depot/perl/op.c#794 edit ... //depot/perl/pp.c#533 edit ... //depot/perl/pp_ctl.c#539 edit ... //depot/perl/pp_hot.c#463 edit ... //depot/perl/scope.c#181 edit ... //depot/perl/scope.h#76 edit ... //depot/perl/toke.c#667 edit Differences ... ==== //depot/perl/cop.h#112 (text) ==== Index: perl/cop.h --- perl/cop.h#111~27643~ 2006-03-31 05:45:57.000000000 -0800 +++ perl/cop.h 2006-04-02 03:08:04.000000000 -0700 @@ -229,6 +229,11 @@ # define OutCopFILE(c) CopFILE(c) #endif +/* CopARYBASE is likely to be removed soon. */ +#define CopARYBASE(c) ((c)->cop_arybase) +#define CopARYBASE_get(c) ((c)->cop_arybase + 0) +#define CopARYBASE_set(c, b) STMT_START { (c)->cop_arybase = (b); } STMT_END + /* * Here we have some enormously heavy (or at least ponderous) wizardry. */ ==== //depot/perl/ext/B/B.xs#112 (text) ==== Index: perl/ext/B/B.xs --- perl/ext/B/B.xs#111~27254~ 2006-02-20 16:02:46.000000000 -0800 +++ perl/ext/B/B.xs 2006-04-02 03:08:04.000000000 -0700 @@ -1057,7 +1057,7 @@ #define COP_file(o) CopFILE(o) #define COP_filegv(o) CopFILEGV(o) #define COP_cop_seq(o) o->cop_seq -#define COP_arybase(o) o->cop_arybase +#define COP_arybase(o) CopARYBASE_get(o) #define COP_line(o) CopLINE(o) #define COP_warnings(o) o->cop_warnings #define COP_io(o) o->cop_io ==== //depot/perl/mg.c#426 (text) ==== Index: perl/mg.c --- perl/mg.c#425~27666~ 2006-04-01 13:17:46.000000000 -0800 +++ perl/mg.c 2006-04-02 03:08:04.000000000 -0700 @@ -963,7 +963,7 @@ case '/': break; case '[': - WITH_THR(sv_setiv(sv, (IV)PL_curcop->cop_arybase)); + WITH_THR(sv_setiv(sv, (IV)CopARYBASE_get(PL_curcop))); break; case '|': if (GvIOp(PL_defoutgv)) @@ -1724,7 +1724,7 @@ dVAR; const AV * const obj = (AV*)mg->mg_obj; if (obj) { - sv_setiv(sv, AvFILL(obj) + PL_curcop->cop_arybase); + sv_setiv(sv, AvFILL(obj) + CopARYBASE_get(PL_curcop)); } else { SvOK_off(sv); } @@ -1737,7 +1737,7 @@ dVAR; AV * const obj = (AV*)mg->mg_obj; if (obj) { - av_fill(obj, SvIV(sv) - PL_curcop->cop_arybase); + av_fill(obj, SvIV(sv) - CopARYBASE_get(PL_curcop)); } else { if (ckWARN(WARN_MISC)) Perl_warner(aTHX_ packWARN(WARN_MISC), @@ -1780,7 +1780,7 @@ I32 i = mg->mg_len; if (DO_UTF8(lsv)) sv_pos_b2u(lsv, &i); - sv_setiv(sv, i + PL_curcop->cop_arybase); + sv_setiv(sv, i + CopARYBASE_get(PL_curcop)); return 0; } } @@ -1817,7 +1817,7 @@ } len = SvPOK(lsv) ? SvCUR(lsv) : sv_len(lsv); - pos = SvIV(sv) - PL_curcop->cop_arybase; + pos = SvIV(sv) - CopARYBASE_get(PL_curcop); if (DO_UTF8(lsv)) { ulen = sv_len_utf8(lsv); @@ -2358,7 +2358,7 @@ } break; case '[': - PL_compiling.cop_arybase = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv); + CopARYBASE_set(&PL_compiling, SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)); break; case '?': #ifdef COMPLEX_STATUS ==== //depot/perl/op.c#794 (text) ==== Index: perl/op.c --- perl/op.c#793~27666~ 2006-04-01 13:17:46.000000000 -0800 +++ perl/op.c 2006-04-02 03:08:04.000000000 -0700 @@ -1103,12 +1103,13 @@ goto nomod; localize = 0; if (PL_eval_start && PL_eval_start->op_type == OP_CONST) { - PL_compiling.cop_arybase = (I32)SvIV(cSVOPx(PL_eval_start)->op_sv); + CopARYBASE_set(&PL_compiling, + (I32)SvIV(cSVOPx(PL_eval_start)->op_sv)); PL_eval_start = 0; } else if (!type) { - SAVEI32(PL_compiling.cop_arybase); - PL_compiling.cop_arybase = 0; + SAVECOPARYBASE(&PL_compiling); + CopARYBASE_set(&PL_compiling, 0); } else if (type == OP_REFGEN) goto nomod; @@ -3906,7 +3907,7 @@ else { /* FIXME for MAD */ op_free(o); - o = newSVOP(OP_CONST, 0, newSViv(PL_compiling.cop_arybase)); + o = newSVOP(OP_CONST, 0, newSViv(CopARYBASE_get(&PL_compiling))); o->op_private |= OPpCONST_ARYBASE; } } @@ -3942,7 +3943,7 @@ PL_hints |= HINT_BLOCK_SCOPE; } cop->cop_seq = seq; - cop->cop_arybase = PL_curcop->cop_arybase; + CopARYBASE_set(cop, CopARYBASE_get(PL_curcop)); if (specialWARN(PL_curcop->cop_warnings)) cop->cop_warnings = PL_curcop->cop_warnings ; else @@ -7648,7 +7649,7 @@ pop->op_next->op_type == OP_AELEM && !(pop->op_next->op_private & (OPpLVAL_INTRO|OPpLVAL_DEFER|OPpDEREF|OPpMAYBE_LVSUB)) && - (i = SvIV(((SVOP*)pop)->op_sv) - PL_curcop->cop_arybase) + (i = SvIV(((SVOP*)pop)->op_sv) - CopARYBASE_get(PL_curcop)) <= 255 && i >= 0) { ==== //depot/perl/pp.c#533 (text) ==== Index: perl/pp.c --- perl/pp.c#532~27641~ 2006-03-31 04:30:31.000000000 -0800 +++ perl/pp.c 2006-04-02 03:08:04.000000000 -0700 @@ -334,7 +334,7 @@ I32 i = mg->mg_len; if (DO_UTF8(sv)) sv_pos_b2u(sv, &i); - PUSHi(i + PL_curcop->cop_arybase); + PUSHi(i + CopARYBASE_get(PL_curcop)); RETURN; } } @@ -2923,7 +2923,7 @@ I32 fail; const I32 lvalue = PL_op->op_flags & OPf_MOD || LVRET; const char *tmps; - const I32 arybase = PL_curcop->cop_arybase; + const I32 arybase = CopARYBASE_get(PL_curcop); SV *repl_sv = NULL; const char *repl = NULL; STRLEN repl_len; @@ -3124,7 +3124,7 @@ I32 retval; const char *tmps; const char *tmps2; - const I32 arybase = PL_curcop->cop_arybase; + const I32 arybase = CopARYBASE_get(PL_curcop); bool big_utf8; bool little_utf8; const bool is_index = PL_op->op_type == OP_INDEX; @@ -3673,7 +3673,7 @@ register const I32 lval = (PL_op->op_flags & OPf_MOD || LVRET); if (SvTYPE(av) == SVt_PVAV) { - const I32 arybase = PL_curcop->cop_arybase; + const I32 arybase = CopARYBASE_get(PL_curcop); if (lval && PL_op->op_private & OPpLVAL_INTRO) { register SV **svp; I32 max = -1; @@ -3926,7 +3926,7 @@ SV ** const lastlelem = PL_stack_base + POPMARK; SV ** const firstlelem = PL_stack_base + POPMARK + 1; register SV ** const firstrelem = lastlelem + 1; - const I32 arybase = PL_curcop->cop_arybase; + const I32 arybase = CopARYBASE_get(PL_curcop); I32 is_something_there = PL_op->op_flags & OPf_MOD; register const I32 max = lastrelem - lastlelem; @@ -4034,7 +4034,7 @@ if (offset < 0) offset += AvFILLp(ary) + 1; else - offset -= PL_curcop->cop_arybase; + offset -= CopARYBASE_get(PL_curcop); if (offset < 0) DIE(aTHX_ PL_no_aelem, i); if (++MARK < SP) { ==== //depot/perl/pp_ctl.c#539 (text) ==== Index: perl/pp_ctl.c --- perl/pp_ctl.c#538~27659~ 2006-04-01 06:31:37.000000000 -0800 +++ perl/pp_ctl.c 2006-04-02 03:08:04.000000000 -0700 @@ -2925,7 +2925,7 @@ PL_eval_root = NULL; PL_error_count = 0; PL_curcop = &PL_compiling; - PL_curcop->cop_arybase = 0; + CopARYBASE_set(PL_curcop, 0); if (saveop && (saveop->op_type != OP_REQUIRE) && (saveop->op_flags & OPf_SPECIAL)) PL_in_eval |= EVAL_KEEPERR; else ==== //depot/perl/pp_hot.c#463 (text) ==== Index: perl/pp_hot.c --- perl/pp_hot.c#462~27641~ 2006-03-31 04:30:31.000000000 -0800 +++ perl/pp_hot.c 2006-04-02 03:08:04.000000000 -0700 @@ -2939,7 +2939,7 @@ if (SvROK(elemsv) && !SvGAMAGIC(elemsv) && ckWARN(WARN_MISC)) Perl_warner(aTHX_ packWARN(WARN_MISC), "Use of reference \"%"SVf"\" as array index", elemsv); if (elem > 0) - elem -= PL_curcop->cop_arybase; + elem -= CopARYBASE_get(PL_curcop); if (SvTYPE(av) != SVt_PVAV) RETPUSHUNDEF; svp = av_fetch(av, elem, lval && !defer); ==== //depot/perl/scope.c#181 (text) ==== Index: perl/scope.c --- perl/scope.c#180~27666~ 2006-04-01 13:17:46.000000000 -0800 +++ perl/scope.c 2006-04-02 03:08:04.000000000 -0700 @@ -981,6 +981,11 @@ ptr = SSPOPPTR; (*SSPOPDPTR)(ptr); break; + case SAVEt_COP_ARYBASE: + ptr = SSPOPPTR; + i = SSPOPINT; + CopARYBASE_set((COP *)ptr, i); + break; default: Perl_croak(aTHX_ "panic: leave_scope inconsistency"); } ==== //depot/perl/scope.h#76 (text) ==== Index: perl/scope.h --- perl/scope.h#75~27666~ 2006-04-01 13:17:46.000000000 -0800 +++ perl/scope.h 2006-04-02 03:08:04.000000000 -0700 @@ -49,6 +49,7 @@ #define SAVEt_BOOL 38 #define SAVEt_SET_SVFLAGS 39 #define SAVEt_SAVESWITCHSTACK 40 +#define SAVEt_COP_ARYBASE 41 #ifndef SCOPE_SAVES_SIGNAL_MASK #define SCOPE_SAVES_SIGNAL_MASK 0 @@ -180,6 +181,15 @@ PL_curstackinfo->si_stack = (t); \ } STMT_END +#define SAVECOPARYBASE(c) \ + STMT_START { \ + SSCHECK(3); \ + SSPUSHINT(CopARYBASE_get(c)); \ + SSPUSHPTR(c); \ + SSPUSHINT(SAVEt_COP_ARYBASE); \ + } STMT_END + + #ifdef USE_ITHREADS # define SAVECOPSTASH(c) SAVEPPTR(CopSTASHPV(c)) # define SAVECOPSTASH_FREE(c) SAVESHAREDPV(CopSTASHPV(c)) ==== //depot/perl/toke.c#667 (text) ==== Index: perl/toke.c --- perl/toke.c#666~27641~ 2006-03-31 04:30:31.000000000 -0800 +++ perl/toke.c 2006-04-02 03:08:04.000000000 -0700 @@ -4555,7 +4555,7 @@ /* This kludge not intended to be bulletproof. */ if (PL_tokenbuf[1] == '[' && !PL_tokenbuf[2]) { yylval.opval = newSVOP(OP_CONST, 0, - newSViv(PL_compiling.cop_arybase)); + newSViv(CopARYBASE_get(&PL_compiling))); yylval.opval->op_private = OPpCONST_ARYBASE; TERM(THING); } End of Patch.