Fix to work match cache with peek next optimization (#9459)
This commit is contained in:
parent
1817d644ee
commit
597955aae8
@ -3758,14 +3758,15 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
|
|||||||
|
|
||||||
CASE(OP_PUSH_IF_PEEK_NEXT) MOP_IN(OP_PUSH_IF_PEEK_NEXT);
|
CASE(OP_PUSH_IF_PEEK_NEXT) MOP_IN(OP_PUSH_IF_PEEK_NEXT);
|
||||||
GET_RELADDR_INC(addr, p);
|
GET_RELADDR_INC(addr, p);
|
||||||
|
CHECK_MATCH_CACHE;
|
||||||
if (*p == *s) {
|
if (*p == *s) {
|
||||||
p++;
|
p++;
|
||||||
CHECK_MATCH_CACHE;
|
|
||||||
STACK_PUSH_ALT(p + addr, s, sprev, pkeep);
|
STACK_PUSH_ALT(p + addr, s, sprev, pkeep);
|
||||||
MOP_OUT;
|
MOP_OUT;
|
||||||
JUMP;
|
JUMP;
|
||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
|
INC_NUM_FAILS;
|
||||||
MOP_OUT;
|
MOP_OUT;
|
||||||
JUMP;
|
JUMP;
|
||||||
|
|
||||||
|
@ -1945,6 +1945,15 @@ class TestRegexp < Test::Unit::TestCase
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_match_cache_with_peek_optimization
|
||||||
|
assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}")
|
||||||
|
timeout = #{ EnvUtil.apply_timeout_scale(10).inspect }
|
||||||
|
begin;
|
||||||
|
Regexp.timeout = timeout
|
||||||
|
assert_nil(/a*z/ =~ "a" * 1000000 + "x")
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
|
||||||
def test_cache_opcodes_initialize
|
def test_cache_opcodes_initialize
|
||||||
str = 'test1-test2-test3-test4-test_5'
|
str = 'test1-test2-test3-test4-test_5'
|
||||||
re = '^([0-9a-zA-Z\-/]*){1,256}$'
|
re = '^([0-9a-zA-Z\-/]*){1,256}$'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user