summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2006-04-05 01:50:33 +0000
committerDave Mitchell <davem@fdisolutions.com>2006-04-05 01:50:33 +0000
commit4f639d21b5c9a079a204ea1a0168f3c1a4ed5214 (patch)
treec2b5d2f8230d423e855973abe39d8126adff6ff3
parent4aabdb9b669fb3cae6e0122289e74e446eaf01cc (diff)
downloadperl-4f639d21b5c9a079a204ea1a0168f3c1a4ed5214.tar.gz
eliminate PL_regprecomp, PL_regprogram, PL_regnpar and PL_regdata
(only another 441 global vars to go ...) p4raw-id: //depot/perl@27716
-rw-r--r--embed.fnc7
-rw-r--r--embed.h8
-rw-r--r--embedvar.h8
-rw-r--r--perlapi.h8
-rw-r--r--proto.h13
-rw-r--r--regcomp.c36
-rw-r--r--regexec.c90
-rw-r--r--sv.c4
-rw-r--r--thrdvar.h4
9 files changed, 62 insertions, 116 deletions
diff --git a/embed.fnc b/embed.fnc
index 6d460989a7..fe1246d244 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1293,7 +1293,7 @@ Es |void |regtail |NN struct RExC_state_t *state|NN regnode *p|NN regnode *val
EsRn |char* |regwhite |NN char *p|NN const char *e
Es |char* |nextchar |NN struct RExC_state_t *state
# ifdef DEBUGGING
-Es |regnode*|dumpuntil |NN regnode *start|NN regnode *node \
+Es |regnode*|dumpuntil |NN regexp *r|NN regnode *start|NN regnode *node \
|NULLOK regnode *last|NN SV* sv|I32 l
Es |void |put_byte |NN SV* sv|int c
# endif
@@ -1320,14 +1320,13 @@ Es |I32 |make_trie |NN struct RExC_state_t* state|NN regnode *startbranch \
#endif
#if defined(PERL_IN_REGEXEC_C) || defined(PERL_DECL_PROT)
-ERs |I32 |regmatch |NN regnode *prog
+ERs |I32 |regmatch |NN regexp *rex|NN regnode *prog
ERs |I32 |regrepeat |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\
|bool do_utf8sv_is_utf8
Es |CHECKPOINT|regcppush |I32 parenfloor
-Es |char*|regcppop
-Es |void |cache_re |NN regexp *prog
+Es |char* |regcppop |NN regexp *rex
ERsn |U8* |reghop3 |NN U8 *pos|I32 off|NN U8 *lim
ERsn |U8* |reghopmaybe3 |NN U8 *pos|I32 off|NN U8 *lim
ERs |char* |find_byclass |NN regexp * prog|NN regnode *c|NN char *s|NN const char *strend|I32 norun
diff --git a/embed.h b/embed.h
index febc317c94..a77f16e4dc 100644
--- a/embed.h
+++ b/embed.h
@@ -1344,7 +1344,6 @@
#define reginclass S_reginclass
#define regcppush S_regcppush
#define regcppop S_regcppop
-#define cache_re S_cache_re
#define reghop3 S_reghop3
#define reghopmaybe3 S_reghopmaybe3
#define find_byclass S_find_byclass
@@ -3471,7 +3470,7 @@
#endif
# ifdef DEBUGGING
#if defined(PERL_CORE) || defined(PERL_EXT)
-#define dumpuntil(a,b,c,d,e) S_dumpuntil(aTHX_ a,b,c,d,e)
+#define dumpuntil(a,b,c,d,e,f) S_dumpuntil(aTHX_ a,b,c,d,e,f)
#define put_byte(a,b) S_put_byte(aTHX_ a,b)
#endif
# endif
@@ -3498,13 +3497,12 @@
#endif
#if defined(PERL_IN_REGEXEC_C) || defined(PERL_DECL_PROT)
#if defined(PERL_CORE) || defined(PERL_EXT)
-#define regmatch(a) S_regmatch(aTHX_ a)
+#define regmatch(a,b) S_regmatch(aTHX_ a,b)
#define regrepeat(a,b) S_regrepeat(aTHX_ a,b)
#define regtry(a,b) S_regtry(aTHX_ a,b)
#define reginclass(a,b,c,d) S_reginclass(aTHX_ a,b,c,d)
#define regcppush(a) S_regcppush(aTHX_ a)
-#define regcppop() S_regcppop(aTHX)
-#define cache_re(a) S_cache_re(aTHX_ a)
+#define regcppop(a) S_regcppop(aTHX_ a)
#define reghop3 S_reghop3
#define reghopmaybe3 S_reghopmaybe3
#define find_byclass(a,b,c,d,e) S_find_byclass(aTHX_ a,b,c,d,e)
diff --git a/embedvar.h b/embedvar.h
index c40bbfa16c..5440e62d5c 100644
--- a/embedvar.h
+++ b/embedvar.h
@@ -105,7 +105,6 @@
#define PL_reg_sv (vTHX->Treg_sv)
#define PL_regbol (vTHX->Tregbol)
#define PL_regcompp (vTHX->Tregcompp)
-#define PL_regdata (vTHX->Tregdata)
#define PL_regdummy (vTHX->Tregdummy)
#define PL_regendp (vTHX->Tregendp)
#define PL_regeol (vTHX->Tregeol)
@@ -121,9 +120,6 @@
#define PL_regmatch_slab (vTHX->Tregmatch_slab)
#define PL_regmatch_state (vTHX->Tregmatch_state)
#define PL_regnarrate (vTHX->Tregnarrate)
-#define PL_regnpar (vTHX->Tregnpar)
-#define PL_regprecomp (vTHX->Tregprecomp)
-#define PL_regprogram (vTHX->Tregprogram)
#define PL_regsize (vTHX->Tregsize)
#define PL_regstartp (vTHX->Tregstartp)
#define PL_regtill (vTHX->Tregtill)
@@ -814,7 +810,6 @@
#define PL_Treg_sv PL_reg_sv
#define PL_Tregbol PL_regbol
#define PL_Tregcompp PL_regcompp
-#define PL_Tregdata PL_regdata
#define PL_Tregdummy PL_regdummy
#define PL_Tregendp PL_regendp
#define PL_Tregeol PL_regeol
@@ -830,9 +825,6 @@
#define PL_Tregmatch_slab PL_regmatch_slab
#define PL_Tregmatch_state PL_regmatch_state
#define PL_Tregnarrate PL_regnarrate
-#define PL_Tregnpar PL_regnpar
-#define PL_Tregprecomp PL_regprecomp
-#define PL_Tregprogram PL_regprogram
#define PL_Tregsize PL_regsize
#define PL_Tregstartp PL_regstartp
#define PL_Tregtill PL_regtill
diff --git a/perlapi.h b/perlapi.h
index 547fdb28c3..27578ac16c 100644
--- a/perlapi.h
+++ b/perlapi.h
@@ -830,8 +830,6 @@ END_EXTERN_C
#define PL_regbol (*Perl_Tregbol_ptr(aTHX))
#undef PL_regcompp
#define PL_regcompp (*Perl_Tregcompp_ptr(aTHX))
-#undef PL_regdata
-#define PL_regdata (*Perl_Tregdata_ptr(aTHX))
#undef PL_regdummy
#define PL_regdummy (*Perl_Tregdummy_ptr(aTHX))
#undef PL_regendp
@@ -862,12 +860,6 @@ END_EXTERN_C
#define PL_regmatch_state (*Perl_Tregmatch_state_ptr(aTHX))
#undef PL_regnarrate
#define PL_regnarrate (*Perl_Tregnarrate_ptr(aTHX))
-#undef PL_regnpar
-#define PL_regnpar (*Perl_Tregnpar_ptr(aTHX))
-#undef PL_regprecomp
-#define PL_regprecomp (*Perl_Tregprecomp_ptr(aTHX))
-#undef PL_regprogram
-#define PL_regprogram (*Perl_Tregprogram_ptr(aTHX))
#undef PL_regsize
#define PL_regsize (*Perl_Tregsize_ptr(aTHX))
#undef PL_regstartp
diff --git a/proto.h b/proto.h
index dc95b03dcb..96c664cdca 100644
--- a/proto.h
+++ b/proto.h
@@ -3548,10 +3548,11 @@ STATIC char* S_nextchar(pTHX_ struct RExC_state_t *state)
__attribute__nonnull__(pTHX_1);
# ifdef DEBUGGING
-STATIC regnode* S_dumpuntil(pTHX_ regnode *start, regnode *node, regnode *last, SV* sv, I32 l)
+STATIC regnode* S_dumpuntil(pTHX_ regexp *r, regnode *start, regnode *node, regnode *last, SV* sv, I32 l)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
- __attribute__nonnull__(pTHX_4);
+ __attribute__nonnull__(pTHX_3)
+ __attribute__nonnull__(pTHX_5);
STATIC void S_put_byte(pTHX_ SV* sv, int c)
__attribute__nonnull__(pTHX_1);
@@ -3619,9 +3620,10 @@ STATIC I32 S_make_trie(pTHX_ struct RExC_state_t* state, regnode *startbranch, r
#endif
#if defined(PERL_IN_REGEXEC_C) || defined(PERL_DECL_PROT)
-STATIC I32 S_regmatch(pTHX_ regnode *prog)
+STATIC I32 S_regmatch(pTHX_ regexp *rex, regnode *prog)
__attribute__warn_unused_result__
- __attribute__nonnull__(pTHX_1);
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
STATIC I32 S_regrepeat(pTHX_ const regnode *p, I32 max)
__attribute__warn_unused_result__
@@ -3638,8 +3640,7 @@ STATIC bool S_reginclass(pTHX_ const regnode *n, const U8 *p, STRLEN *lenp, bool
__attribute__nonnull__(pTHX_2);
STATIC CHECKPOINT S_regcppush(pTHX_ I32 parenfloor);
-STATIC char* S_regcppop(pTHX);
-STATIC void S_cache_re(pTHX_ regexp *prog)
+STATIC char* S_regcppop(pTHX_ regexp *rex)
__attribute__nonnull__(pTHX_1);
STATIC U8* S_reghop3(U8 *pos, I32 off, U8 *lim)
diff --git a/regcomp.c b/regcomp.c
index c236a736c7..3e939dff41 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3107,7 +3107,6 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
struct regnode_charclass_class);
r->regstclass = (regnode*)RExC_rx->data->data[n];
r->reganch &= ~ROPT_SKIP; /* Used in find_byclass(). */
- PL_regdata = r->data; /* for regprop() */
DEBUG_COMPILE_r({ SV *sv = sv_newmortal();
regprop(sv, (regnode*)data.start_class);
PerlIO_printf(Perl_debug_log,
@@ -3182,7 +3181,6 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
r->reganch |= ROPT_CANY_SEEN;
Newxz(r->startp, RExC_npar, I32);
Newxz(r->endp, RExC_npar, I32);
- PL_regdata = r->data; /* for regprop() */
DEBUG_COMPILE_r(regdump(r));
return(r);
}
@@ -5672,7 +5670,7 @@ Perl_regdump(pTHX_ regexp *r)
dVAR;
SV * const sv = sv_newmortal();
- (void)dumpuntil(r->program, r->program + 1, NULL, sv, 0);
+ (void)dumpuntil(r, r->program, r->program + 1, NULL, sv, 0);
/* Header fields of interest. */
if (r->anchored_substr)
@@ -5805,17 +5803,8 @@ Perl_regprop(pTHX_ SV *sv, const regnode *o)
PL_colors[1]);
} else if (k == TRIE) {
/*EMPTY*/;
- /*
- this isn't always safe, as Pl_regdata may not be for this regex yet
- (depending on where its called from) so its being moved to dumpuntil
- I32 n = ARG(o);
- reg_trie_data *trie=(reg_trie_data*)PL_regdata->data[n];
- Perl_sv_catpvf(aTHX_ sv, " (W:%d L:%d C:%d S:%d)",
- trie->wordcount,
- trie->charcount,
- trie->uniquecharcount,
- trie->laststate);
- */
+ /* print the details od the trie in dumpuntil instead, as
+ * prog->data isn't available here */
} else if (k == CURLY) {
if (OP(o) == CURLYM || OP(o) == CURLYN || OP(o) == CURLYX)
Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags); /* Parenth number */
@@ -6192,10 +6181,8 @@ Perl_save_re_context(pTHX)
PL_reg_start_tmp = 0;
SAVEI32(PL_reg_start_tmpl); /* from regexec.c */
PL_reg_start_tmpl = 0;
- SAVEVPTR(PL_regdata);
SAVEI32(PL_reg_eval_set); /* from regexec.c */
SAVEI32(PL_regnarrate); /* from regexec.c */
- SAVEVPTR(PL_regprogram); /* from regexec.c */
SAVEINT(PL_regindent); /* from regexec.c */
SAVEVPTR(PL_curcop);
SAVEVPTR(PL_reg_call_cc); /* from regexec.c */
@@ -6223,8 +6210,6 @@ Perl_save_re_context(pTHX)
PL_reg_poscache = NULL;
SAVEI32(PL_reg_poscache_size); /* size of pos cache of WHILEM */
PL_reg_poscache_size = 0;
- SAVEPPTR(PL_regprecomp); /* uncompiled string. */
- SAVEI32(PL_regnpar); /* () count. */
SAVEI32(PL_regsize); /* from regexec.c */
/* Save $1..$n (#18107: UTF-8 s/(\w+)/uc($1)/e); AMS 20021106. */
@@ -6274,7 +6259,8 @@ S_put_byte(pTHX_ SV *sv, int c)
STATIC regnode *
-S_dumpuntil(pTHX_ regnode *start, regnode *node, regnode *last, SV* sv, I32 l)
+S_dumpuntil(pTHX_ regexp *r, regnode *start, regnode *node, regnode *last,
+ SV* sv, I32 l)
{
dVAR;
register U8 op = EXACT; /* Arbitrary non-END op. */
@@ -6306,14 +6292,14 @@ S_dumpuntil(pTHX_ regnode *start, regnode *node, regnode *last, SV* sv, I32 l)
: next);
if (last && nnode > last)
nnode = last;
- node = dumpuntil(start, NEXTOPER(NEXTOPER(node)), nnode, sv, l + 1);
+ node = dumpuntil(r, start, NEXTOPER(NEXTOPER(node)), nnode, sv, l + 1);
}
else if (PL_regkind[(U8)op] == BRANCH) {
- node = dumpuntil(start, NEXTOPER(node), next, sv, l + 1);
+ node = dumpuntil(r, start, NEXTOPER(node), next, sv, l + 1);
}
else if ( PL_regkind[(U8)op] == TRIE ) {
const I32 n = ARG(node);
- const reg_trie_data * const trie = (reg_trie_data*)PL_regdata->data[n];
+ const reg_trie_data * const trie = (reg_trie_data*)r->data->data[n];
const I32 arry_len = av_len(trie->words)+1;
I32 word_idx;
PerlIO_printf(Perl_debug_log,
@@ -6350,15 +6336,15 @@ S_dumpuntil(pTHX_ regnode *start, regnode *node, regnode *last, SV* sv, I32 l)
}
else if ( op == CURLY) { /* "next" might be very big: optimizer */
- node = dumpuntil(start, NEXTOPER(node) + EXTRA_STEP_2ARGS,
+ node = dumpuntil(r, start, NEXTOPER(node) + EXTRA_STEP_2ARGS,
NEXTOPER(node) + EXTRA_STEP_2ARGS + 1, sv, l + 1);
}
else if (PL_regkind[(U8)op] == CURLY && op != CURLYX) {
- node = dumpuntil(start, NEXTOPER(node) + EXTRA_STEP_2ARGS,
+ node = dumpuntil(r, start, NEXTOPER(node) + EXTRA_STEP_2ARGS,
next, sv, l + 1);
}
else if ( op == PLUS || op == STAR) {
- node = dumpuntil(start, NEXTOPER(node), NEXTOPER(node) + 1, sv, l + 1);
+ node = dumpuntil(r, start, NEXTOPER(node), NEXTOPER(node) + 1, sv, l + 1);
}
else if (op == ANYOF) {
/* arglen 1 + class block */
diff --git a/regexec.c b/regexec.c
index 8367eef71f..2f6313dace 100644
--- a/regexec.c
+++ b/regexec.c
@@ -213,7 +213,7 @@ S_regcppush(pTHX_ I32 parenfloor)
(IV)(cp), (IV)PL_savestack_ix) : 0); regcpblow(cp)
STATIC char *
-S_regcppop(pTHX)
+S_regcppop(pTHX_ regexp *rex)
{
dVAR;
I32 i;
@@ -251,10 +251,10 @@ S_regcppop(pTHX)
);
}
DEBUG_EXECUTE_r(
- if ((I32)(*PL_reglastparen + 1) <= PL_regnpar) {
+ if ((I32)(*PL_reglastparen + 1) <= rex->nparens) {
PerlIO_printf(Perl_debug_log,
" restoring \\%"IVdf"..\\%"IVdf" to undef\n",
- (IV)(*PL_reglastparen + 1), (IV)PL_regnpar);
+ (IV)(*PL_reglastparen + 1), (IV)rex->nparens);
}
);
#if 1
@@ -268,7 +268,7 @@ S_regcppop(pTHX)
* building DynaLoader will fail:
* "Error: '*' not in typemap in DynaLoader.xs, line 164"
* --jhi */
- for (paren = *PL_reglastparen + 1; (I32)paren <= PL_regnpar; paren++) {
+ for (paren = *PL_reglastparen + 1; (I32)paren <= rex->nparens; paren++) {
if ((I32)paren > PL_regsize)
PL_regstartp[paren] = -1;
PL_regendp[paren] = -1;
@@ -316,18 +316,6 @@ Perl_pregexec(pTHX_ register regexp *prog, char *stringarg, register char *stren
nosave ? 0 : REXEC_COPY_STR);
}
-STATIC void
-S_cache_re(pTHX_ regexp *prog)
-{
- dVAR;
- PL_regprecomp = prog->precomp; /* Needed for FAIL. */
-#ifdef DEBUGGING
- PL_regprogram = prog->program;
-#endif
- PL_regnpar = prog->nparens;
- PL_regdata = prog->data;
- PL_reg_re = prog;
-}
/*
* Need to implement the following flags for reg_anch:
@@ -852,7 +840,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
: strend);
t = s;
- cache_re(prog);
+ PL_reg_re = prog;
s = find_byclass(prog, prog->regstclass, s, endpos, 1);
if (!s) {
#ifdef DEBUGGING
@@ -1630,7 +1618,7 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char *
PERL_UNUSED_ARG(data);
RX_MATCH_UTF8_set(prog,do_utf8);
- cache_re(prog);
+ PL_reg_re = prog;
#ifdef DEBUGGING
PL_regnarrate = DEBUG_r_TEST;
#endif
@@ -2026,7 +2014,7 @@ got_it:
sv_setsv(oreplsv, GvSV(PL_replgv));/* So that when GvSV(replgv) is
restored, the value remains
the same. */
- restore_pos(aTHX_ 0);
+ restore_pos(aTHX_ prog);
}
/* make sure $`, $&, $', and $digit will work later */
@@ -2066,7 +2054,7 @@ phooey:
DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%sMatch failed%s\n",
PL_colors[4], PL_colors[5]));
if (PL_reg_eval_set)
- restore_pos(aTHX_ 0);
+ restore_pos(aTHX_ prog);
return 0;
}
@@ -2122,7 +2110,7 @@ S_regtry(pTHX_ regexp *prog, char *startpos)
}
PL_reg_magic = mg;
PL_reg_oldpos = mg->mg_len;
- SAVEDESTRUCTOR_X(restore_pos, 0);
+ SAVEDESTRUCTOR_X(restore_pos, prog);
}
if (!PL_reg_curpm) {
Newxz(PL_reg_curpm, 1, PMOP);
@@ -2199,7 +2187,7 @@ S_regtry(pTHX_ regexp *prog, char *startpos)
}
#endif
REGCP_SET(lastcp);
- if (regmatch(prog->program + 1)) {
+ if (regmatch(prog, prog->program + 1)) {
prog->endp[0] = PL_reginput - PL_bostr;
return 1;
}
@@ -2426,7 +2414,7 @@ S_push_slab(pTHX)
STATIC I32 /* 0 failure, 1 success */
-S_regmatch(pTHX_ regnode *prog)
+S_regmatch(pTHX_ regexp *rex, regnode *prog)
{
dVAR;
register const bool do_utf8 = PL_reg_match_utf8;
@@ -2545,7 +2533,7 @@ S_regmatch(pTHX_ regnode *prog)
PL_colors[1],
15 - l - pref_len + 1,
"",
- (IV)(scan - PL_regprogram), PL_regindent*2, "",
+ (IV)(scan - rex->program), PL_regindent*2, "",
SvPVX_const(prop));
}
});
@@ -2653,7 +2641,7 @@ S_regmatch(pTHX_ regnode *prog)
/* what trie are we using right now */
reg_trie_data *trie
- = (reg_trie_data*)PL_regdata->data[ ARG( scan ) ];
+ = (reg_trie_data*)PL_reg_re->data->data[ ARG( scan ) ];
st->u.trie.accepted = 0; /* how many accepting states we have seen */
result = 0;
@@ -3274,9 +3262,9 @@ S_regmatch(pTHX_ regnode *prog)
struct regexp * const oreg = PL_reg_re;
n = ARG(scan);
- PL_op = (OP_4tree*)PL_regdata->data[n];
+ PL_op = (OP_4tree*)PL_reg_re->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_regdata->data[n + 2]);
+ PAD_SAVE_LOCAL(old_comppad, (PAD*)PL_reg_re->data->data[n + 2]);
PL_regendp[0] = PL_reg_magic->mg_len = locinput - PL_bostr;
CALLRUNOPS(aTHX); /* Scalar context. */
@@ -3294,7 +3282,7 @@ S_regmatch(pTHX_ regnode *prog)
if (!st->logical) {
/* /(?{...})/ */
sv_setsv(save_scalar(PL_replgv), ret);
- cache_re(oreg);
+ PL_reg_re = oreg;
break;
}
}
@@ -3304,6 +3292,9 @@ S_regmatch(pTHX_ regnode *prog)
int toggleutf;
{
+ /* extract RE object from returned value; compiling if
+ * necessary */
+
MAGIC *mg = NULL;
SV *sv;
if(SvROK(ret) && SvSMAGICAL(sv = SvRV(ret)))
@@ -3323,9 +3314,7 @@ S_regmatch(pTHX_ regnode *prog)
STRLEN len;
const char * const t = SvPV_const(ret, len);
PMOP pm;
- char * const oprecomp = PL_regprecomp;
const I32 osize = PL_regsize;
- const I32 onpar = PL_regnpar;
Zero(&pm, 1, PMOP);
if (DO_UTF8(ret)) pm.op_pmdynflags |= PMdf_DYN_UTF8;
@@ -3335,9 +3324,7 @@ S_regmatch(pTHX_ regnode *prog)
| SVs_GMG)))
sv_magic(ret,(SV*)ReREFCNT_inc(re),
PERL_MAGIC_qr,0,0);
- PL_regprecomp = oprecomp;
PL_regsize = osize;
- PL_regnpar = onpar;
}
}
DEBUG_EXECUTE_r(
@@ -3357,7 +3344,7 @@ S_regmatch(pTHX_ regnode *prog)
st->u.eval.cp = regcppush(0); /* Save *all* the positions. */
REGCP_SET(st->u.eval.lastcp);
- cache_re(re);
+ PL_reg_re = re;
state.ss = PL_savestack_ix;
*PL_reglastparen = 0;
*PL_reglastcloseparen = 0;
@@ -3371,7 +3358,7 @@ S_regmatch(pTHX_ regnode *prog)
PL_reg_maxiter = 0;
/* XXX the only recursion left in regmatch() */
- if (regmatch(re->program + 1)) {
+ if (regmatch(re, re->program + 1)) {
/* Even though we succeeded, we need to restore
global variables, since we may be wrapped inside
SUSPEND, thus the match may be not finished yet. */
@@ -3380,7 +3367,7 @@ S_regmatch(pTHX_ regnode *prog)
PL_reg_call_cc = state.prev;
st->cc = state.cc;
PL_reg_re = state.re;
- cache_re(PL_reg_re);
+
if (toggleutf) PL_reg_flags ^= RF_utf8;
/* XXXX This is too dramatic a measure... */
@@ -3393,11 +3380,10 @@ S_regmatch(pTHX_ regnode *prog)
}
ReREFCNT_dec(re);
REGCP_UNWIND(st->u.eval.lastcp);
- regcppop();
+ regcppop(rex);
PL_reg_call_cc = state.prev;
st->cc = state.cc;
PL_reg_re = state.re;
- cache_re(PL_reg_re);
if (toggleutf) PL_reg_flags ^= RF_utf8;
/* XXXX This is too dramatic a measure... */
@@ -3682,7 +3668,7 @@ S_regmatch(pTHX_ regnode *prog)
CACHEsayYES; /* All done. */
}
REGCP_UNWIND(st->u.whilem.lastcp);
- regcppop();
+ regcppop(rex);
if (st->cc->u.curlyx.outercc)
st->cc->u.curlyx.outercc->u.curlyx.cur = st->ln;
@@ -3715,7 +3701,7 @@ S_regmatch(pTHX_ regnode *prog)
CACHEsayYES;
}
REGCP_UNWIND(st->u.whilem.lastcp);
- regcppop();
+ regcppop(rex);
st->cc->u.curlyx.cur = n - 1;
st->cc->u.curlyx.lastloc = st->u.whilem.lastloc;
CACHEsayNO;
@@ -3735,7 +3721,7 @@ S_regmatch(pTHX_ regnode *prog)
CACHEsayYES;
}
REGCP_UNWIND(st->u.whilem.lastcp);
- regcppop(); /* Restore some previous $<digit>s? */
+ regcppop(rex); /* Restore some previous $<digit>s? */
PL_reginput = locinput;
DEBUG_EXECUTE_r(
PerlIO_printf(Perl_debug_log,
@@ -4258,14 +4244,14 @@ S_regmatch(pTHX_ regnode *prog)
{
I32 tmp = PL_savestack_ix;
PL_savestack_ix = PL_reg_call_cc->ss;
- regcppop();
+ regcppop(rex);
PL_savestack_ix = tmp;
}
/* Make position available to the callcc. */
PL_reginput = locinput;
- cache_re(PL_reg_call_cc->re);
+ PL_reg_re = PL_reg_call_cc->re;
st->u.end.savecc = st->cc;
st->cc = PL_reg_call_cc->cc;
PL_reg_call_cc = PL_reg_call_cc->prev;
@@ -4277,11 +4263,10 @@ S_regmatch(pTHX_ regnode *prog)
sayYES;
}
REGCP_UNWIND(st->u.end.lastcp);
- regcppop();
+ regcppop(rex);
PL_reg_call_cc = st->u.end.cur_call_cc;
st->cc = st->u.end.savecc;
PL_reg_re = st->u.end.end_re;
- cache_re(st->u.end.end_re);
DEBUG_EXECUTE_r(
PerlIO_printf(Perl_debug_log,
@@ -4834,12 +4819,13 @@ Perl_regclass_swash(pTHX_ register const regnode* node, bool doinit, SV** listsv
SV *sw = NULL;
SV *si = NULL;
SV *alt = NULL;
+ const struct reg_data *data = PL_reg_re->data;
- if (PL_regdata && PL_regdata->count) {
+ if (data && data->count) {
const U32 n = ARG(node);
- if (PL_regdata->what[n] == 's') {
- SV * const rv = (SV*)PL_regdata->data[n];
+ if (data->what[n] == 's') {
+ SV * const rv = (SV*)data->data[n];
AV * const av = (AV*)SvRV((SV*)rv);
SV **const ary = AvARRAY(av);
SV **a, **b;
@@ -5063,15 +5049,15 @@ static void
restore_pos(pTHX_ void *arg)
{
dVAR;
- PERL_UNUSED_ARG(arg);
+ regexp *rex = (regexp *)arg;
if (PL_reg_eval_set) {
if (PL_reg_oldsaved) {
- PL_reg_re->subbeg = PL_reg_oldsaved;
- PL_reg_re->sublen = PL_reg_oldsavedlen;
+ rex->subbeg = PL_reg_oldsaved;
+ rex->sublen = PL_reg_oldsavedlen;
#ifdef PERL_OLD_COPY_ON_WRITE
- PL_reg_re->saved_copy = PL_nrs;
+ rex->saved_copy = PL_nrs;
#endif
- RX_MATCH_COPIED_on(PL_reg_re);
+ RX_MATCH_COPIED_on(rex);
}
PL_reg_magic->mg_len = PL_reg_oldpos;
PL_reg_eval_set = 0;
diff --git a/sv.c b/sv.c
index d1a4a6c8a8..acadce7e40 100644
--- a/sv.c
+++ b/sv.c
@@ -11432,8 +11432,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_watchok = NULL;
PL_regdummy = proto_perl->Tregdummy;
- PL_regprecomp = NULL;
- PL_regnpar = 0;
PL_regsize = 0;
PL_colorset = 0; /* reinits PL_colors[] */
/*PL_colors[6] = {0,0,0,0,0,0};*/
@@ -11447,12 +11445,10 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_regtill = NULL;
PL_reg_start_tmp = (char**)NULL;
PL_reg_start_tmpl = 0;
- PL_regdata = (struct reg_data*)NULL;
PL_bostr = NULL;
PL_reg_flags = 0;
PL_reg_eval_set = 0;
PL_regnarrate = 0;
- PL_regprogram = (regnode*)NULL;
PL_regindent = 0;
PL_reg_call_cc = (struct re_cc_state*)NULL;
PL_reg_re = (regexp*)NULL;
diff --git a/thrdvar.h b/thrdvar.h
index 34bd747679..c626f5f7e8 100644
--- a/thrdvar.h
+++ b/thrdvar.h
@@ -160,8 +160,6 @@ PERLVARI(Tmaxscream, I32, -1)
PERLVAR(Tlastscream, SV *)
PERLVAR(Tregdummy, regnode) /* from regcomp.c */
-PERLVAR(Tregprecomp, char *) /* uncompiled string. */
-PERLVAR(Tregnpar, I32) /* () count. */
PERLVAR(Tregsize, I32) /* Code size. */
PERLVAR(Tcolorset, int) /* from regcomp.c */
PERLVARA(Tcolors,6, char *) /* from regcomp.c */
@@ -175,13 +173,11 @@ PERLVAR(Treglastcloseparen, U32 *) /* Similarly for lastcloseparen. */
PERLVAR(Tregtill, char *) /* How far we are required to go. */
PERLVAR(Treg_start_tmp, char **) /* from regexec.c */
PERLVAR(Treg_start_tmpl,U32) /* from regexec.c */
-PERLVAR(Tregdata, struct reg_data *)
/* from regexec.c renamed was data */
PERLVAR(Tbostr, char *) /* from regexec.c */
PERLVAR(Treg_flags, U32) /* from regexec.c */
PERLVAR(Treg_eval_set, I32) /* from regexec.c */
PERLVAR(Tregnarrate, I32) /* from regexec.c */
-PERLVAR(Tregprogram, regnode *) /* from regexec.c */
PERLVARI(Tregindent, int, 0) /* from regexec.c */
PERLVAR(Treg_call_cc, struct re_cc_state *) /* from regexec.c */
PERLVAR(Treg_re, regexp *) /* from regexec.c */