From: Dave Mitchell Date: Thu, 13 Apr 2006 02:20:33 +0000 (+0000) Subject: eliminate PL_reg_re X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=32fc9b6af894c845c5b239287596b88571b3fcdf;p=p5sagit%2Fp5-mst-13.2.git eliminate PL_reg_re (only another 439 to go ...) p4raw-id: //depot/perl@27783 --- diff --git a/embed.fnc b/embed.fnc index 9544007..9133ed5 100644 --- a/embed.fnc +++ b/embed.fnc @@ -650,7 +650,7 @@ Ap |void |push_scope Amb |OP* |ref |NULLOK OP* o|I32 type p |OP* |refkids |NULLOK OP* o|I32 type Ap |void |regdump |NN const regexp* r -Ap |SV* |regclass_swash |NN const struct regnode *n|bool doinit|NULLOK SV **listsvp|NULLOK SV **altsvp +Ap |SV* |regclass_swash |NULLOK const regexp *prog|NN const struct regnode *n|bool doinit|NULLOK SV **listsvp|NULLOK SV **altsvp Ap |I32 |pregexec |NN regexp* prog|NN char* stringarg \ |NN char* strend|NN char* strbeg|I32 minend \ |NN SV* screamer|U32 nosave @@ -664,7 +664,7 @@ Ap |I32 |regexec_flags |NN regexp* prog|NN char* stringarg \ |NN char* strend|NN char* strbeg|I32 minend \ |NN SV* screamer|NULLOK void* data|U32 flags ApR |regnode*|regnext |NN regnode* p -Ep |void |regprop |NN SV* sv|NN const regnode* o +Ep |void |regprop |NULLOK const regexp *prog|NN SV* sv|NN const regnode* o Ap |void |repeatcpy |NN char* to|NN const char* from|I32 len|I32 count ApP |char* |rninstr |NN const char* big|NN const char* bigend \ |NN const char* little|NN const char* lend @@ -1315,9 +1315,9 @@ Es |I32 |make_trie |NN struct RExC_state_t* state|NN regnode *startbranch \ #if defined(PERL_IN_REGEXEC_C) || defined(PERL_DECL_PROT) ERs |I32 |regmatch |NN regexp *rex|NN regnode *prog -ERs |I32 |regrepeat |NN const regnode *p|I32 max +ERs |I32 |regrepeat |NN const regexp *prog|NN const regnode *p|I32 max ERs |I32 |regtry |NN regexp *prog|NN char *startpos -ERs |bool |reginclass |NN const regnode *n|NN const U8 *p|NULLOK STRLEN *lenp\ +ERs |bool |reginclass |NULLOK const regexp *prog|NN const regnode *n|NN const U8 *p|NULLOK STRLEN *lenp\ |bool do_utf8sv_is_utf8 Es |CHECKPOINT|regcppush |I32 parenfloor Es |char* |regcppop |NN const regexp *rex diff --git a/embed.h b/embed.h index 1f8d310..d3a7c79 100644 --- a/embed.h +++ b/embed.h @@ -2833,7 +2833,7 @@ #define refkids(a,b) Perl_refkids(aTHX_ a,b) #endif #define regdump(a) Perl_regdump(aTHX_ a) -#define regclass_swash(a,b,c,d) Perl_regclass_swash(aTHX_ a,b,c,d) +#define regclass_swash(a,b,c,d,e) Perl_regclass_swash(aTHX_ a,b,c,d,e) #define pregexec(a,b,c,d,e,f,g) Perl_pregexec(aTHX_ a,b,c,d,e,f,g) #define pregfree(a) Perl_pregfree(aTHX_ a) #define pregcomp(a,b,c) Perl_pregcomp(aTHX_ a,b,c) @@ -2842,7 +2842,7 @@ #define regexec_flags(a,b,c,d,e,f,g,h) Perl_regexec_flags(aTHX_ a,b,c,d,e,f,g,h) #define regnext(a) Perl_regnext(aTHX_ a) #if defined(PERL_CORE) || defined(PERL_EXT) -#define regprop(a,b) Perl_regprop(aTHX_ a,b) +#define regprop(a,b,c) Perl_regprop(aTHX_ a,b,c) #endif #define repeatcpy(a,b,c,d) Perl_repeatcpy(aTHX_ a,b,c,d) #define rninstr(a,b,c,d) Perl_rninstr(aTHX_ a,b,c,d) @@ -3492,9 +3492,9 @@ #if defined(PERL_IN_REGEXEC_C) || defined(PERL_DECL_PROT) #if defined(PERL_CORE) || defined(PERL_EXT) #define regmatch(a,b) S_regmatch(aTHX_ a,b) -#define regrepeat(a,b) S_regrepeat(aTHX_ a,b) +#define regrepeat(a,b,c) S_regrepeat(aTHX_ a,b,c) #define regtry(a,b) S_regtry(aTHX_ a,b) -#define reginclass(a,b,c,d) S_reginclass(aTHX_ a,b,c,d) +#define reginclass(a,b,c,d,e) S_reginclass(aTHX_ a,b,c,d,e) #define regcppush(a) S_regcppush(aTHX_ a) #define regcppop(a) S_regcppop(aTHX_ a) #define reghop3 S_reghop3 diff --git a/pod/perlintern.pod b/pod/perlintern.pod index 402befd..3190e09 100644 --- a/pod/perlintern.pod +++ b/pod/perlintern.pod @@ -485,26 +485,6 @@ in C. =for hackers Found in file hv.c -=item refcounted_he_copy -X - -Copies a chain of C. Used by C. - - struct refcounted_he * refcounted_he_copy(const struct refcounted_he *he) - -=for hackers -Found in file hv.c - -=item refcounted_he_dup -X - -Duplicates the C for a new thread. - - struct refcounted_he * refcounted_he_dup(const struct refcounted_he *const he, CLONE_PARAMS* param) - -=for hackers -Found in file hv.c - =item refcounted_he_free X diff --git a/proto.h b/proto.h index 30f1fb0..7153481 100644 --- a/proto.h +++ b/proto.h @@ -1805,8 +1805,8 @@ PERL_CALLCONV OP* Perl_refkids(pTHX_ OP* o, I32 type); PERL_CALLCONV void Perl_regdump(pTHX_ const regexp* r) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV SV* Perl_regclass_swash(pTHX_ const struct regnode *n, bool doinit, SV **listsvp, SV **altsvp) - __attribute__nonnull__(pTHX_1); +PERL_CALLCONV SV* Perl_regclass_swash(pTHX_ const regexp *prog, const struct regnode *n, bool doinit, SV **listsvp, SV **altsvp) + __attribute__nonnull__(pTHX_2); PERL_CALLCONV I32 Perl_pregexec(pTHX_ regexp* prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, U32 nosave) __attribute__nonnull__(pTHX_1) @@ -1840,9 +1840,9 @@ PERL_CALLCONV regnode* Perl_regnext(pTHX_ regnode* p) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); -PERL_CALLCONV void Perl_regprop(pTHX_ SV* sv, const regnode* o) - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2); +PERL_CALLCONV void Perl_regprop(pTHX_ const regexp *prog, SV* sv, const regnode* o) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); PERL_CALLCONV void Perl_repeatcpy(pTHX_ char* to, const char* from, I32 len, I32 count) __attribute__nonnull__(pTHX_1) @@ -3619,19 +3619,20 @@ STATIC I32 S_regmatch(pTHX_ regexp *rex, regnode *prog) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); -STATIC I32 S_regrepeat(pTHX_ const regnode *p, I32 max) +STATIC I32 S_regrepeat(pTHX_ const regexp *prog, const regnode *p, I32 max) __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); STATIC I32 S_regtry(pTHX_ regexp *prog, char *startpos) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); -STATIC bool S_reginclass(pTHX_ const regnode *n, const U8 *p, STRLEN *lenp, bool do_utf8sv_is_utf8) +STATIC bool S_reginclass(pTHX_ const regexp *prog, const regnode *n, const U8 *p, STRLEN *lenp, bool do_utf8sv_is_utf8) __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2); + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); STATIC CHECKPOINT S_regcppush(pTHX_ I32 parenfloor); STATIC char* S_regcppop(pTHX_ const regexp *rex) diff --git a/regcomp.c b/regcomp.c index 8815003..663b343 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1537,7 +1537,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, /* Peephole optimizer: */ DEBUG_OPTIMISE_r({ SV * const mysv=sv_newmortal(); - regprop( mysv, scan); + regprop(RExC_rx, mysv, scan); PerlIO_printf(Perl_debug_log, "%*speep: %s (0x%08"UVXf")\n", (int)depth*2, "", SvPV_nolen_const(mysv), PTR2UV(scan)); }); @@ -1832,7 +1832,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, } DEBUG_OPTIMISE_r({ - regprop( mysv, tail ); + regprop(RExC_rx, mysv, tail ); PerlIO_printf( Perl_debug_log, "%*s%s%s%s\n", (int)depth * 2 + 2, "", "Tail node is:", SvPV_nolen_const( mysv ), (RExC_seen_evals) ? "[EVAL]" : "" @@ -1869,16 +1869,16 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, regnode * const noper_next = regnext( noper ); DEBUG_OPTIMISE_r({ - regprop( mysv, cur); + regprop(RExC_rx, mysv, cur); PerlIO_printf( Perl_debug_log, "%*s%s", (int)depth * 2 + 2," ", SvPV_nolen_const( mysv ) ); - regprop( mysv, noper); + regprop(RExC_rx, mysv, noper); PerlIO_printf( Perl_debug_log, " -> %s", SvPV_nolen_const(mysv)); if ( noper_next ) { - regprop( mysv, noper_next ); + regprop(RExC_rx, mysv, noper_next ); PerlIO_printf( Perl_debug_log,"\t=> %s\t", SvPV_nolen_const(mysv)); } @@ -1896,20 +1896,20 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, } else { DEBUG_OPTIMISE_r( if (!last ) { - regprop( mysv, first); + regprop(RExC_rx, mysv, first); PerlIO_printf( Perl_debug_log, "%*s%s", (int)depth * 2 + 2, "F:", SvPV_nolen_const( mysv ) ); - regprop( mysv, NEXTOPER(first) ); + regprop(RExC_rx, mysv, NEXTOPER(first) ); PerlIO_printf( Perl_debug_log, " -> %s\n", SvPV_nolen_const( mysv ) ); } ); last = cur; DEBUG_OPTIMISE_r({ - regprop( mysv, cur); + regprop(RExC_rx, mysv, cur); PerlIO_printf( Perl_debug_log, "%*s%s", (int)depth * 2 + 2, "N:", SvPV_nolen_const( mysv ) ); - regprop( mysv, noper ); + regprop(RExC_rx, mysv, noper ); PerlIO_printf( Perl_debug_log, " -> %s\n", SvPV_nolen_const( mysv ) ); }); @@ -1937,7 +1937,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, } } DEBUG_OPTIMISE_r({ - regprop( mysv, cur); + regprop(RExC_rx, mysv, cur); PerlIO_printf( Perl_debug_log, "%*s%s\t(0x%p,0x%p,0x%p)\n", (int)depth * 2 + 2, " ", SvPV_nolen_const( mysv ), first, last, cur); @@ -3109,7 +3109,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm) r->regstclass = (regnode*)RExC_rx->data->data[n]; r->reganch &= ~ROPT_SKIP; /* Used in find_byclass(). */ DEBUG_COMPILE_r({ SV *sv = sv_newmortal(); - regprop(sv, (regnode*)data.start_class); + regprop(r, sv, (regnode*)data.start_class); PerlIO_printf(Perl_debug_log, "synthetic stclass \"%s\".\n", SvPVX_const(sv));}); @@ -3164,7 +3164,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm) r->regstclass = (regnode*)RExC_rx->data->data[n]; r->reganch &= ~ROPT_SKIP; /* Used in find_byclass(). */ DEBUG_COMPILE_r({ SV* sv = sv_newmortal(); - regprop(sv, (regnode*)data.start_class); + regprop(r, sv, (regnode*)data.start_class); PerlIO_printf(Perl_debug_log, "synthetic stclass \"%s\".\n", SvPVX_const(sv));}); @@ -5719,7 +5719,7 @@ Perl_regdump(pTHX_ const regexp *r) PerlIO_printf(Perl_debug_log, ") "); if (r->regstclass) { - regprop(sv, r->regstclass); + regprop(r, sv, r->regstclass); PerlIO_printf(Perl_debug_log, "stclass \"%s\" ", SvPVX_const(sv)); } if (r->reganch & ROPT_ANCH) { @@ -5766,7 +5766,7 @@ Perl_regdump(pTHX_ const regexp *r) - regprop - printable representation of opcode */ void -Perl_regprop(pTHX_ SV *sv, const regnode *o) +Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o) { #ifdef DEBUGGING dVAR; @@ -5887,7 +5887,7 @@ Perl_regprop(pTHX_ SV *sv, const regnode *o) { SV *lv; - SV * const sw = regclass_swash(o, FALSE, &lv, 0); + SV * const sw = regclass_swash(prog, o, FALSE, &lv, 0); if (lv) { if (sw) { @@ -6249,7 +6249,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, /* Where, what. */ if (OP(node) == OPTIMIZED) goto after_print; - regprop(sv, node); + regprop(r, sv, node); PerlIO_printf(Perl_debug_log, "%4"IVdf":%*s%s", (IV)(node - start), (int)(2*l + 1), "", SvPVX_const(sv)); if (next == NULL) /* Next ptr. */ diff --git a/regexec.c b/regexec.c index 47c4422..459002a 100644 --- a/regexec.c +++ b/regexec.c @@ -107,7 +107,7 @@ #define STATIC static #endif -#define REGINCLASS(p,c) (ANYOF_FLAGS(p) ? reginclass(p,c,0,0) : ANYOF_BITMAP_TEST(p,*(c))) +#define REGINCLASS(prog,p,c) (ANYOF_FLAGS(p) ? reginclass(prog,p,c,0,0) : ANYOF_BITMAP_TEST(p,*(c))) /* * Forwards. @@ -839,7 +839,6 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, : strend); t = s; - PL_reg_re = prog; s = find_byclass(prog, prog->regstclass, s, endpos, 1); if (!s) { #ifdef DEBUGGING @@ -954,8 +953,8 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, const char *stren while (s + (uskip = UTF8SKIP(s)) <= strend) { if ((ANYOF_FLAGS(c) & ANYOF_UNICODE) || !UTF8_IS_INVARIANT((U8)s[0]) ? - reginclass(c, (U8*)s, 0, do_utf8) : - REGINCLASS(c, (U8*)s)) { + reginclass(prog, c, (U8*)s, 0, do_utf8) : + REGINCLASS(prog, c, (U8*)s)) { if (tmp && (norun || regtry(prog, s))) goto got_it; else @@ -970,7 +969,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, const char *stren while (s < strend) { STRLEN skip = 1; - if (REGINCLASS(c, (U8*)s) || + if (REGINCLASS(prog, c, (U8*)s) || (ANYOF_FOLD_SHARP_S(c, s, strend) && /* The assignment of 2 is intentional: * for the folded sharp s, the skip is 2. */ @@ -1622,7 +1621,6 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * return 0; } - PL_reg_re = prog; #ifdef DEBUGGING PL_regnarrate = DEBUG_r_TEST; #endif @@ -1912,7 +1910,7 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * int len0; int len1; - regprop(prop, c); + regprop(prog, prop, c); s0 = UTF ? pv_uni_display(dsv0, (U8*)SvPVX_const(prop), SvCUR(prop), 60, UNI_DISPLAY_REGEX) : @@ -2537,7 +2535,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) pref0_len = 0; if (pref0_len > pref_len) pref0_len = pref_len; - regprop(prop, scan); + regprop(rex, prop, scan); { const char * const s0 = do_utf8 && OP(scan) != CANY ? @@ -2679,7 +2677,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) /* what trie are we using right now */ reg_trie_data *trie - = (reg_trie_data*)PL_reg_re->data->data[ ARG( scan ) ]; + = (reg_trie_data*)rex->data->data[ ARG( scan ) ]; st->u.trie.accepted = 0; /* how many accepting states we have seen */ result = 0; @@ -2844,7 +2842,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) } DEBUG_EXECUTE_r({ reg_trie_data * const trie = (reg_trie_data*) - PL_reg_re->data->data[ARG(scan)]; + rex->data->data[ARG(scan)]; SV ** const tmp = av_fetch( trie->words, st->u.trie.accept_buff[ best ].wordnum - 1, 0 ); PerlIO_printf( Perl_debug_log, "%*s %strying alternation #%d <%s> at 0x%p%s\n", REPORT_CODE_OFF+PL_regindent*2, "", PL_colors[4], @@ -2986,7 +2984,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) if (do_utf8) { STRLEN inclasslen = PL_regeol - locinput; - if (!reginclass(scan, (U8*)locinput, &inclasslen, do_utf8)) + if (!reginclass(rex, scan, (U8*)locinput, &inclasslen, do_utf8)) sayNO_ANYOF; if (locinput >= PL_regeol) sayNO; @@ -2997,7 +2995,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) else { if (nextchr < 0) nextchr = UCHARAT(locinput); - if (!REGINCLASS(scan, (U8*)locinput)) + if (!REGINCLASS(rex, scan, (U8*)locinput)) sayNO_ANYOF; if (!nextchr && locinput >= PL_regeol) sayNO; @@ -3299,12 +3297,11 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) OP_4tree * const oop = PL_op; COP * const ocurcop = PL_curcop; PAD *old_comppad; - struct regexp * const oreg = PL_reg_re; n = ARG(scan); - PL_op = (OP_4tree*)PL_reg_re->data->data[n]; + PL_op = (OP_4tree*)rex->data->data[n]; DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, " re_eval 0x%"UVxf"\n", PTR2UV(PL_op)) ); - PAD_SAVE_LOCAL(old_comppad, (PAD*)PL_reg_re->data->data[n + 2]); + PAD_SAVE_LOCAL(old_comppad, (PAD*)rex->data->data[n + 2]); PL_regendp[0] = PL_reg_magic->mg_len = locinput - PL_bostr; CALLRUNOPS(aTHX); /* Scalar context. */ @@ -3319,7 +3316,6 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) PL_op = oop; PAD_RESTORE_LOCAL(old_comppad); PL_curcop = ocurcop; - PL_reg_re = oreg; if (!st->logical) { /* /(?{...})/ */ sv_setsv(save_scalar(PL_replgv), ret); @@ -3390,9 +3386,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) ((re->reganch & ROPT_UTF8) != 0); if (st->u.eval.toggleutf) PL_reg_flags ^= RF_utf8; st->u.eval.prev_rex = rex; - assert(rex == PL_reg_re); /* XXX */ rex = re; - PL_reg_re = rex; /* XXX */ st->u.eval.prev_eval = cur_eval; st->u.eval.prev_slab = PL_regmatch_slab; @@ -4080,7 +4074,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) PL_reginput = locinput; if (st->minmod) { st->minmod = 0; - if (st->ln && regrepeat(scan, st->ln) < st->ln) + if (st->ln && regrepeat(rex, scan, st->ln) < st->ln) sayNO; locinput = PL_reginput; REGCP_SET(st->u.plus.lastcp); @@ -4152,7 +4146,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) /* PL_reginput == old now */ if (locinput != st->u.plus.old) { st->ln = 1; /* Did some */ - if (regrepeat(scan, st->u.plus.count) < st->u.plus.count) + if (regrepeat(rex, scan, st->u.plus.count) < st->u.plus.count) sayNO; } /* PL_reginput == locinput now */ @@ -4196,7 +4190,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) } /* Couldn't or didn't -- move forward. */ PL_reginput = locinput; - if (regrepeat(scan, 1)) { + if (regrepeat(rex, scan, 1)) { st->ln++; locinput = PL_reginput; } @@ -4205,7 +4199,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) } } else { - n = regrepeat(scan, n); + n = regrepeat(rex, scan, n); locinput = PL_reginput; if (st->ln < n && PL_regkind[(U8)OP(next)] == EOL && (OP(next) != MEOL || @@ -4269,7 +4263,6 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) PL_reg_flags ^= RF_utf8; ReREFCNT_dec(rex); rex = st->u.eval.prev_rex; - PL_reg_re = rex; /* XXX */ /* XXXX This is too dramatic a measure... */ PL_reg_maxiter = 0; @@ -4560,7 +4553,6 @@ do_no: PL_reg_flags ^= RF_utf8; ReREFCNT_dec(rex); rex = st->u.eval.prev_rex; - PL_reg_re = rex; /* XXX */ cur_eval = st->u.eval.prev_eval; /* XXXX This is too dramatic a measure... */ @@ -4638,7 +4630,7 @@ final_exit: * rather than incrementing count on every character. [Er, except utf8.]] */ STATIC I32 -S_regrepeat(pTHX_ const regnode *p, I32 max) +S_regrepeat(pTHX_ const regexp *prog, const regnode *p, I32 max) { dVAR; register char *scan; @@ -4701,12 +4693,12 @@ S_regrepeat(pTHX_ const regnode *p, I32 max) if (do_utf8) { loceol = PL_regeol; while (hardcount < max && scan < loceol && - reginclass(p, (U8*)scan, 0, do_utf8)) { + reginclass(prog, p, (U8*)scan, 0, do_utf8)) { scan += UTF8SKIP(scan); hardcount++; } } else { - while (scan < loceol && REGINCLASS(p, (U8*)scan)) + while (scan < loceol && REGINCLASS(prog, p, (U8*)scan)) scan++; } break; @@ -4867,7 +4859,7 @@ S_regrepeat(pTHX_ const regnode *p, I32 max) SV * const prop = sv_newmortal(); GET_RE_DEBUG_FLAGS; DEBUG_EXECUTE_r({ - regprop(prop, p); + regprop(prog, prop, p); PerlIO_printf(Perl_debug_log, "%*s %s can match %"IVdf" times out of %"IVdf"...\n", REPORT_CODE_OFF+1, "", SvPVX_const(prop),(IV)c,(IV)max); @@ -4883,13 +4875,13 @@ S_regrepeat(pTHX_ const regnode *p, I32 max) */ SV * -Perl_regclass_swash(pTHX_ register const regnode* node, bool doinit, SV** listsvp, SV **altsvp) +Perl_regclass_swash(pTHX_ const regexp *prog, register const regnode* node, bool doinit, SV** listsvp, SV **altsvp) { dVAR; SV *sw = NULL; SV *si = NULL; SV *alt = NULL; - const struct reg_data *data = PL_reg_re ? PL_reg_re->data : NULL; + const struct reg_data *data = prog ? prog->data : NULL; if (data && data->count) { const U32 n = ARG(node); @@ -4937,7 +4929,7 @@ Perl_regclass_swash(pTHX_ register const regnode* node, bool doinit, SV** listsv */ STATIC bool -S_reginclass(pTHX_ register const regnode *n, register const U8* p, STRLEN* lenp, register bool do_utf8) +S_reginclass(pTHX_ const regexp *prog, register const regnode *n, register const U8* p, STRLEN* lenp, register bool do_utf8) { dVAR; const char flags = ANYOF_FLAGS(n); @@ -4966,7 +4958,7 @@ S_reginclass(pTHX_ register const regnode *n, register const U8* p, STRLEN* lenp match = TRUE; if (!match) { AV *av; - SV * const sw = regclass_swash(n, TRUE, 0, (SV**)&av); + SV * const sw = regclass_swash(prog, n, TRUE, 0, (SV**)&av); if (sw) { if (swash_fetch(sw, p, do_utf8)) diff --git a/regexp.h b/regexp.h index bb02d22..1e4ca4d 100644 --- a/regexp.h +++ b/regexp.h @@ -289,7 +289,6 @@ typedef struct regmatch_slab { #define PL_reg_eval_set PL_reg_state.re_state_reg_eval_set #define PL_regnarrate PL_reg_state.re_state_regnarrate #define PL_regindent PL_reg_state.re_state_regindent -#define PL_reg_re PL_reg_state.re_state_reg_re #define PL_reg_ganch PL_reg_state.re_state_reg_ganch #define PL_reg_sv PL_reg_state.re_state_reg_sv #define PL_reg_match_utf8 PL_reg_state.re_state_reg_match_utf8 @@ -323,7 +322,6 @@ struct re_save_state { I32 re_state_reg_eval_set; /* from regexec.c */ I32 re_state_regnarrate; /* from regexec.c */ int re_state_regindent; /* from regexec.c */ - regexp *re_state_reg_re; /* from regexec.c */ char *re_state_reg_ganch; /* from regexec.c */ SV *re_state_reg_sv; /* from regexec.c */ bool re_state_reg_match_utf8; /* from regexec.c */ diff --git a/sv.c b/sv.c index b32121a..3b9dfb8 100644 --- a/sv.c +++ b/sv.c @@ -10657,8 +10657,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param) /* I assume that it only ever "worked" because no-one called (pseudo)fork while the regexp engine had re-entered itself. */ - new_state->re_state_reg_re - = any_dup(old_state->re_state_reg_re, proto_perl); new_state->re_state_reg_ganch = pv_dup(old_state->re_state_reg_ganch); new_state->re_state_reg_sv