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
|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
#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
#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)
#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)
#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
=for hackers
Found in file hv.c
-=item refcounted_he_copy
-X<refcounted_he_copy>
-
-Copies a chain of C<struct refcounted_he *>. Used by C<pp_entereval>.
-
- struct refcounted_he * refcounted_he_copy(const struct refcounted_he *he)
-
-=for hackers
-Found in file hv.c
-
-=item refcounted_he_dup
-X<refcounted_he_dup>
-
-Duplicates the C<struct refcounted_he *> 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<refcounted_he_free>
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)
__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)
__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)
/* 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));
});
}
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]" : ""
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));
}
} 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 ) );
});
}
}
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);
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));});
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));});
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) {
- 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;
{
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) {
/* 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. */
#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.
: strend);
t = s;
- PL_reg_re = prog;
s = find_byclass(prog, prog->regstclass, s, endpos, 1);
if (!s) {
#ifdef DEBUGGING
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
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. */
return 0;
}
- PL_reg_re = prog;
#ifdef DEBUGGING
PL_regnarrate = DEBUG_r_TEST;
#endif
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) :
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 ?
/* 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;
}
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],
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;
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;
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. */
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);
((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;
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);
/* 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 */
}
/* Couldn't or didn't -- move forward. */
PL_reginput = locinput;
- if (regrepeat(scan, 1)) {
+ if (regrepeat(rex, scan, 1)) {
st->ln++;
locinput = PL_reginput;
}
}
}
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 ||
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;
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... */
* 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;
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;
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);
*/
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);
*/
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);
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))
#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
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 */
/* 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