Fix control verb chain restoration issue in JIT.

This commit is contained in:
Zoltán Herczeg 2020-02-10 10:18:01 +00:00
parent d71dc302a5
commit 697cf5f602
3 changed files with 8 additions and 4 deletions

View File

@ -60,6 +60,9 @@ parsed_skip()" could result.
nested groups for starting code units, in order to avoid stack overflow issues. nested groups for starting code units, in order to avoid stack overflow issues.
If the limit is reached, it just gives up trying for this optimization. If the limit is reached, it just gives up trying for this optimization.
16. The control verb chain list must always be restored when exiting from a
recurse function in JIT.
Version 10.34 21-November-2019 Version 10.34 21-November-2019
------------------------------ ------------------------------

View File

@ -2693,8 +2693,8 @@ while (cc < ccend)
} }
if (common->control_head_ptr != 0 && !control_head_found) if (common->control_head_ptr != 0 && !control_head_found)
{ {
shared_srcw[0] = common->control_head_ptr; private_srcw[0] = common->control_head_ptr;
shared_count = 1; private_count = 1;
control_head_found = TRUE; control_head_found = TRUE;
} }
cc += 1 + 2 + cc[1]; cc += 1 + 2 + cc[1];
@ -2704,8 +2704,8 @@ while (cc < ccend)
SLJIT_ASSERT(common->control_head_ptr != 0); SLJIT_ASSERT(common->control_head_ptr != 0);
if (!control_head_found) if (!control_head_found)
{ {
shared_srcw[0] = common->control_head_ptr; private_srcw[0] = common->control_head_ptr;
shared_count = 1; private_count = 1;
control_head_found = TRUE; control_head_found = TRUE;
} }
cc++; cc++;

View File

@ -861,6 +861,7 @@ static struct regression_test_case regression_test_cases[] = {
{ MU, A, 0, 0 | F_NOMATCH, "(?(?=a)a(*THEN)b|ad)", "ad" }, { MU, A, 0, 0 | F_NOMATCH, "(?(?=a)a(*THEN)b|ad)", "ad" },
{ MU, A, 0, 0, "(?!(?(?=a)ab|b(*THEN)d))bn|bnn", "bnn" }, { MU, A, 0, 0, "(?!(?(?=a)ab|b(*THEN)d))bn|bnn", "bnn" },
{ MU, A, 0, 0, "(?=(*THEN: ))* ", " " }, { MU, A, 0, 0, "(?=(*THEN: ))* ", " " },
{ MU, A, 0, 0, "a(*THEN)(?R) |", "a" },
/* Recurse and control verbs. */ /* Recurse and control verbs. */
{ MU, A, 0, 0, "(a(*ACCEPT)b){0}a(?1)b", "aacaabb" }, { MU, A, 0, 0, "(a(*ACCEPT)b){0}a(?1)b", "aacaabb" },