Reworked the recursive pattern matching in the JIT compiler to follow the interpreter changes.

This commit is contained in:
Zoltán Herczeg 2017-03-19 03:35:27 +00:00
parent 73735b81a3
commit b55ef12cc1
5 changed files with 722 additions and 424 deletions

View File

@ -56,6 +56,9 @@ reference \1 precedes the group (abc). This fixes oss-fuzz issue 865.
pcre2test to use it to output the frame size when the "framesize" modifier is
given.
7. Reworked the recursive pattern matching in the JIT compiler to follow the
interpreter changes.
Version 10.23 14-February-2017
------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -707,7 +707,7 @@ static struct regression_test_case regression_test_cases[] = {
{ MU, A, 0, 0, "(?1)(((a(*ACCEPT)))b)", "axaa" },
{ MU, A, 0, 0, "(?1)(?(DEFINE) (((ac(*ACCEPT)))b) )", "akaac" },
{ MU, A, 0, 0, "(a+)b(?1)b\\1", "abaaabaaaaa" },
// { MU, A, 0, 0 | F_NOMATCH, "(?(DEFINE)(aa|a))(?1)ab", "aab" },
{ MU, A, 0, 0, "(?(DEFINE)(aa|a))(?1)ab", "aab" },
{ MU, A, 0, 0, "(?(DEFINE)(a\\Kb))(?1)+ababc", "abababxabababc" },
{ MU, A, 0, 0, "(a\\Kb)(?1)+ababc", "abababxababababc" },
{ MU, A, 0, 0 | F_NOMATCH, "(a\\Kb)(?1)+ababc", "abababxababababxc" },
@ -722,7 +722,7 @@ static struct regression_test_case regression_test_cases[] = {
{ MU, A, 0, 0, "(?P<Name>a(?(R&Name)a|b))(?1)", "aab abb abaa" },
{ MU, A, 0, 0, "((?(R)a|(?1)){3})", "XaaaaaaaaaX" },
{ MU, A, 0, 0, "((?:(?(R)a|(?1))){3})", "XaaaaaaaaaX" },
// { MU, A, 0, 0, "((?(R)a|(?1)){1,3})aaaaaa", "aaaaaaaaXaaaaaaaaa" },
{ MU, A, 0, 0, "((?(R)a|(?1)){1,3})aaaaaa", "aaaaaaaaXaaaaaaaaa" },
{ MU, A, 0, 0, "((?(R)a|(?1)){1,3}?)M", "aaaM" },
/* 16 bit specific tests. */
@ -848,7 +848,6 @@ static struct regression_test_case regression_test_cases[] = {
{ MU, A, 0, 0, "((a?)+)+b", "aaaaaaaaaaaa b" },
/* Deep recursion: Stack limit reached. */
// { M, A, 0, 0 | F_NOMATCH, "a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa" },
{ M, A, 0, 0 | F_NOMATCH, "a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa" },
{ M, A, 0, 0 | F_NOMATCH, "(?:a+)+b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },
{ M, A, 0, 0 | F_NOMATCH, "(?:a+?)+?b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },

32
testdata/testinput2 vendored
View File

@ -4959,7 +4959,7 @@ a)"xI
\=ovector=7777777777
/(?1)(A(*COMMIT)|B)D/
BAXBAD\=no_jit
BAXBAD\=no_jit
"(?1){2}(a)"B
@ -4979,27 +4979,27 @@ a)"xI
# update. They require backtracking into recursions.
/^(.|(.)(?1)\2)$/
a\=no_jit
aba\=no_jit
abcba\=no_jit
ababa\=no_jit
abcdcba\=no_jit
a
aba
abcba
ababa
abcdcba
/^((.)(?1)\2|.?)$/
a\=no_jit
aba\=no_jit
abba\=no_jit
abcba\=no_jit
ababa\=no_jit
abccba\=no_jit
abcdcba\=no_jit
abcddcba\=no_jit
a
aba
abba
abcba
ababa
abccba
abcdcba
abcddcba
/^(.)(\1|a(?2))/
bab\=no_jit
bab
/^(.|(.)(?1)?\2)$/
abcba\=no_jit
abcba
# The first of these, when run by Perl, give the mark 'aa', which is wrong.

32
testdata/testoutput2 vendored
View File

@ -15426,7 +15426,7 @@ Subject length lower bound = 11
** Invalid value in 'ovector=7777777777'
/(?1)(A(*COMMIT)|B)D/
BAXBAD\=no_jit
BAXBAD\=no_jit
0: BAD
1: A
@ -15484,67 +15484,67 @@ Subject length lower bound = 11
# update. They require backtracking into recursions.
/^(.|(.)(?1)\2)$/
a\=no_jit
a
0: a
1: a
aba\=no_jit
aba
0: aba
1: aba
2: a
abcba\=no_jit
abcba
0: abcba
1: abcba
2: a
ababa\=no_jit
ababa
0: ababa
1: ababa
2: a
abcdcba\=no_jit
abcdcba
0: abcdcba
1: abcdcba
2: a
/^((.)(?1)\2|.?)$/
a\=no_jit
a
0: a
1: a
aba\=no_jit
aba
0: aba
1: aba
2: a
abba\=no_jit
abba
0: abba
1: abba
2: a
abcba\=no_jit
abcba
0: abcba
1: abcba
2: a
ababa\=no_jit
ababa
0: ababa
1: ababa
2: a
abccba\=no_jit
abccba
0: abccba
1: abccba
2: a
abcdcba\=no_jit
abcdcba
0: abcdcba
1: abcdcba
2: a
abcddcba\=no_jit
abcddcba
0: abcddcba
1: abcddcba
2: a
/^(.)(\1|a(?2))/
bab\=no_jit
bab
0: bab
1: b
2: ab
/^(.|(.)(?1)?\2)$/
abcba\=no_jit
abcba
0: abcba
1: abcba
2: a