diff options
author | Yves Orton <demerphq@gmail.com> | 2023-01-09 21:27:14 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-01-15 13:46:02 +0100 |
commit | c5b1c090dbd52c47488c0f80eecb9cb7fa6f93e3 (patch) | |
tree | e5241c2ce0f81912f6d1f77d61a7bdfcaaaaecd6 /regcomp_study.c | |
parent | ee2168cf3ae08f222fd07cf66fb88a26c15e6306 (diff) | |
download | perl-c5b1c090dbd52c47488c0f80eecb9cb7fa6f93e3.tar.gz |
regcomp_study.c - Add a way to disable CURLYX optimisations
Also break up the condition so there is one condition per line so
it is more readable, and fold repeated binary tests together. This
makes it more obvious what the expression is doing.
Diffstat (limited to 'regcomp_study.c')
-rw-r--r-- | regcomp_study.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/regcomp_study.c b/regcomp_study.c index bf61d34f48..296de3f7e4 100644 --- a/regcomp_study.c +++ b/regcomp_study.c @@ -2689,11 +2689,14 @@ Perl_study_chunk(pTHX_ DEBUG_STUDYDATA("after-whilem accept", data, depth, is_inf, min, stopmin, delta); } /* Try powerful optimization CURLYX => CURLYN. */ - if ( OP(oscan) == CURLYX && data - && data->flags & SF_IN_PAR - && !(data->flags & SF_HAS_EVAL) - && !deltanext && minnext == 1 - && mutate_ok + if ( RE_OPTIMIZE_CURLYX_TO_CURLYN + && OP(oscan) == CURLYX + && data + && data->flags & SF_IN_PAR + && !(data->flags & SF_HAS_EVAL) + && !deltanext + && minnext == 1 + && mutate_ok ) { /* Try to optimize to CURLYN. */ regnode *nxt = REGNODE_AFTER_type(oscan, tregnode_CURLYX); @@ -2739,15 +2742,16 @@ Perl_study_chunk(pTHX_ nogo: /* Try optimization CURLYX => CURLYM. */ - if ( OP(oscan) == CURLYX && data - && !(data->flags & SF_HAS_PAR) - && !(data->flags & SF_HAS_EVAL) - && !deltanext /* atom is fixed width */ - && minnext != 0 /* CURLYM can't handle zero width */ + if ( RE_OPTIMIZE_CURLYX_TO_CURLYM + && OP(oscan) == CURLYX + && data + && !(data->flags & (SF_HAS_PAR|SF_HAS_EVAL)) + && !deltanext /* atom is fixed width */ + && minnext != 0 /* CURLYM can't handle zero width */ /* Nor characters whose fold at run-time may be * multi-character */ - && ! (RExC_seen & REG_UNFOLDED_MULTI_SEEN) - && mutate_ok + && !(RExC_seen & REG_UNFOLDED_MULTI_SEEN) + && mutate_ok ) { /* XXXX How to optimize if data == 0? */ /* Optimize to a simpler form. */ |