Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Fix #81424: PCRE2 10.35 JIT performance regression
This commit is contained in:
Christoph M. Becker 2021-10-12 14:21:46 +02:00
commit 5356d06990
No known key found for this signature in database
GPG Key ID: D66C9593118BCCB6
3 changed files with 26 additions and 8 deletions

5
NEWS
View File

@ -19,7 +19,7 @@ PHP NEWS
(Derick)
- PCRE:
. Unfixed bug #81424 (PCRE2 10.35 JIT performance regression). (cmb)
. Fixed bug #81424 (PCRE2 10.35 JIT performance regression). (cmb)
- PgSQL:
. Fixed bug #81509 (pg_end_copy still expects a resource). (Matteo)
@ -83,9 +83,6 @@ PHP NEWS
. Fixed bug #81409 (Incorrect JIT code for ADD with a reference to array).
(Dmitry)
- PCRE:
. Fixed bug #81424 (PCRE2 10.35 JIT performance regression). (cmb)
- Zip:
. Fixed bug #80833 (ZipArchive::getStream doesn't use setPassword). (Remi)

View File

@ -1251,10 +1251,13 @@ SLJIT_ASSERT(*cc == OP_ONCE || *cc == OP_BRA || *cc == OP_CBRA);
SLJIT_ASSERT(*cc != OP_CBRA || common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] != 0);
SLJIT_ASSERT(start < EARLY_FAIL_ENHANCE_MAX);
next_alt = cc + GET(cc, 1);
if (*next_alt == OP_ALT)
fast_forward_allowed = FALSE;
do
{
count = start;
next_alt = cc + GET(cc, 1);
cc += 1 + LINK_SIZE + ((*cc == OP_CBRA) ? IMM2_SIZE : 0);
while (TRUE)
@ -1512,7 +1515,7 @@ do
{
count++;
if (fast_forward_allowed && *next_alt == OP_KET)
if (fast_forward_allowed)
{
common->fast_forward_bc_ptr = accelerated_start;
common->private_data_ptrs[(accelerated_start + 1) - common->start] = ((*private_data_start) << 3) | type_skip;
@ -1562,8 +1565,8 @@ do
else if (result < count)
result = count;
fast_forward_allowed = FALSE;
cc = next_alt;
next_alt = cc + GET(cc, 1);
}
while (*cc == OP_ALT);
@ -11228,7 +11231,7 @@ early_fail_type = (early_fail_ptr & 0x7);
early_fail_ptr >>= 3;
/* During recursion, these optimizations are disabled. */
if (common->early_fail_start_ptr == 0)
if (common->early_fail_start_ptr == 0 && common->fast_forward_bc_ptr == NULL)
{
early_fail_ptr = 0;
early_fail_type = type_skip;

View File

@ -0,0 +1,18 @@
--TEST--
Bug #81424 (PCRE2 10.35 JIT performance regression)
--DESCRIPTION--
We're testing against the functional regression which has been introduced by
fixing the performance regression.
--FILE--
<?php
var_dump(
preg_match('/(?P<size>\d+)m|M/', "4M", $m),
$m
);
?>
--EXPECT--
int(1)
array(1) {
[0]=>
string(1) "M"
}