summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-01-21 20:32:01 +0100
committerNicholas Clark <nick@ccl4.org>2013-03-19 11:53:19 +0100
commit1067df30ae91aad06ce62722a2ebd437e25358bf (patch)
treec19c3c77061a80759825807b02734d7dd1d4287c
parenta9d37de4f0d6753136e788d7997eaef2b3e47ba0 (diff)
downloadperl-1067df30ae91aad06ce62722a2ebd437e25358bf.tar.gz
In Perl_re_op_compile(), tidy up after removing setjmp().
Remove volatile qualifiers. Remove the variable jump_ret. Move the initialisation of restudied back to the declaration. This reverts several of the changes made by commits 5d51ce98fae3de07 and bbd61b5ffb7621c2. However, I can't see a cleaner way to avoid code duplication when restarting the parse than to approach I've taken here - the label redo_first_pass is now inside an if (0) block, which is clear but ugly.
-rw-r--r--embed.fnc2
-rw-r--r--proto.h2
-rw-r--r--regcomp.c38
3 files changed, 17 insertions, 25 deletions
diff --git a/embed.fnc b/embed.fnc
index 5752774b23..6f3adc6148 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1106,7 +1106,7 @@ Ap |REGEXP*|pregcomp |NN SV * const pattern|const U32 flags
p |REGEXP*|re_op_compile |NULLOK SV ** const patternp \
|int pat_count|NULLOK OP *expr \
|NN const regexp_engine* eng \
- |NULLOK REGEXP *VOL old_re \
+ |NULLOK REGEXP *old_re \
|NULLOK bool *is_bare_re \
|U32 rx_flags|U32 pm_flags
Ap |REGEXP*|re_compile |NN SV * const pattern|U32 orig_rx_flags
diff --git a/proto.h b/proto.h
index 6169cb2960..52f2098536 100644
--- a/proto.h
+++ b/proto.h
@@ -3263,7 +3263,7 @@ PERL_CALLCONV SV* Perl_re_intuit_string(pTHX_ REGEXP *const r)
#define PERL_ARGS_ASSERT_RE_INTUIT_STRING \
assert(r)
-PERL_CALLCONV REGEXP* Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, OP *expr, const regexp_engine* eng, REGEXP *VOL old_re, bool *is_bare_re, U32 rx_flags, U32 pm_flags)
+PERL_CALLCONV REGEXP* Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, OP *expr, const regexp_engine* eng, REGEXP *old_re, bool *is_bare_re, U32 rx_flags, U32 pm_flags)
__attribute__nonnull__(pTHX_4);
#define PERL_ARGS_ASSERT_RE_OP_COMPILE \
assert(eng)
diff --git a/regcomp.c b/regcomp.c
index b7a66a5dc4..03044ffcbf 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -5198,7 +5198,7 @@ S_setup_longest(pTHX_ RExC_state_t *pRExC_state, SV* sv_longest, SV** rx_utf8, S
REGEXP *
Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
- OP *expr, const regexp_engine* eng, REGEXP *VOL old_re,
+ OP *expr, const regexp_engine* eng, REGEXP *old_re,
bool *is_bare_re, U32 orig_rx_flags, U32 pm_flags)
{
dVAR;
@@ -5206,14 +5206,14 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
struct regexp *r;
regexp_internal *ri;
STRLEN plen;
- char * VOL exp;
+ char *exp;
char* xend;
regnode *scan;
I32 flags;
I32 minlen = 0;
U32 rx_flags;
- SV * VOL pat;
- SV * VOL code_blocksv = NULL;
+ SV *pat;
+ SV *code_blocksv = NULL;
/* these are all flags - maybe they should be turned
* into a single int with different bit masks */
@@ -5222,14 +5222,13 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
I32 sawopen = 0;
regex_charset initial_charset = get_regex_charset(orig_rx_flags);
bool code_is_utf8 = 0;
- bool VOL recompile = 0;
+ bool recompile = 0;
bool runtime_code = 0;
- U8 jump_ret = 0;
scan_data_t data;
RExC_state_t RExC_state;
RExC_state_t * const pRExC_state = &RExC_state;
#ifdef TRIE_STUDY_OPT
- int restudied;
+ int restudied = 0;
RExC_state_t copyRExC_state;
#endif
GET_RE_DEBUG_FLAGS_DECL;
@@ -5554,6 +5553,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
}
exp = SvPV_nomg(pat, plen);
+ xend = exp + plen;
if (!eng->op_comp) {
if ((SvUTF8(pat) && IN_BYTES)
@@ -5574,19 +5574,16 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
RExC_contains_locale = 0;
pRExC_state->runtime_code_qr = NULL;
- redo_first_pass:
- if (jump_ret == 0) { /* First time through */
- xend = exp + plen;
-
- DEBUG_COMPILE_r({
+ DEBUG_COMPILE_r({
SV *dsv= sv_newmortal();
- RE_PV_QUOTED_DECL(s, RExC_utf8,
- dsv, exp, plen, 60);
+ RE_PV_QUOTED_DECL(s, RExC_utf8, dsv, exp, plen, 60);
PerlIO_printf(Perl_debug_log, "%sCompiling REx%s %s\n",
- PL_colors[4],PL_colors[5],s);
+ PL_colors[4],PL_colors[5],s);
});
- }
- else { /* longjumped back */
+
+ if (0) {
+ redo_first_pass:
+ {
U8 *src, *dst;
int n=0;
STRLEN s = 0, d = 0;
@@ -5642,6 +5639,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
xend = exp + plen;
SAVEFREEPV(exp);
RExC_orig_utf8 = RExC_utf8 = 1;
+ }
}
/* return old regex if pattern hasn't changed */
@@ -5670,10 +5668,6 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
runtime_code = S_has_runtime_code(aTHX_ pRExC_state, expr, pm_flags,
exp, plen);
-#ifdef TRIE_STUDY_OPT
- restudied = 0;
-#endif
-
rx_flags = orig_rx_flags;
if (initial_charset == REGEX_LOCALE_CHARSET) {
@@ -5697,7 +5691,6 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
if (!S_compile_runtime_code(aTHX_ pRExC_state, exp, plen)) {
/* whoops, we have a non-utf8 pattern, whilst run-time code
* got compiled as utf8. Try again with a utf8 pattern */
- jump_ret = 42;
goto redo_first_pass;
}
}
@@ -5755,7 +5748,6 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
}
if (reg(pRExC_state, 0, &flags,1) == NULL) {
if (flags & RESTART_UTF8) {
- jump_ret = 42;
goto redo_first_pass;
}
Perl_croak(aTHX_ "panic: reg returned NULL to re_op_compile for sizing pass, flags=%#X", flags);