[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5

From: Date: Mon, 19 Oct 2026 19:18:53 +0000
Subject: [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142466@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Date: 2026-10-19T21:18:12+02:00 Commit: https://github.com/php/php-src/commit/59b1db2df2a25eb2ec961e139e2cbcd0b2c54f82 Raw diff: https://github.com/php/php-src/commit/59b1db2df2a25eb2ec961e139e2cbcd0b2c54f82.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: Fix GH-24206: Tracing JIT loses loop-carried CV when its loop PHI is reloaded from memory Changed paths: A ext/opcache/tests/jit/gh24206.phpt M NEWS M ext/opcache/jit/zend_jit_trace.c Diff: diff --git a/NEWS b/NEWS index 74d637709c51..9619601b20ac 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,8 @@ PHP NEWS exits). (Lazizbek Ergashev) . Fixed bug GH-24391 (JIT switch on constant null takes default instead of case 0). (ndossche) + . Fixed bug GH-24206 (Tracing JIT loses loop-carried CV when its loop PHI + is reloaded from memory). (ndossche) - PDO: . Fixed a duplicate warning when ATTR_STATEMENT_CLASS is rejected on a diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 53235702fa44..a6d2830c4d3d 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -3322,6 +3322,7 @@ static zend_jit_reg_var* zend_jit_trace_allocate_registers(zend_jit_trace_rec *t RA_REG_FLAGS(def) |= ZREG_LOAD; RA_REG_FLAGS(use) |= ZREG_STORE; } else { + /* trace-entry value */ use = phi->sources[0]; if (zend_jit_var_supports_reg(ssa, use)) { ZEND_ASSERT(!RA_HAS_REG(use)); @@ -3330,6 +3331,8 @@ static zend_jit_reg_var* zend_jit_trace_allocate_registers(zend_jit_trace_rec *t count++; } else { RA_REG_FLAGS(def) |= ZREG_LOAD; + /* back-edge value */ + RA_REG_FLAGS(phi->sources[1]) |= ZREG_STORE; } } } else if (RA_HAS_REG(use)) { diff --git a/ext/opcache/tests/jit/gh24206.phpt b/ext/opcache/tests/jit/gh24206.phpt new file mode 100644 index 000000000000..258aa9d2eb1d --- /dev/null +++ b/ext/opcache/tests/jit/gh24206.phpt @@ -0,0 +1,65 @@ +--TEST-- +GH-24206: Tracing JIT loses loop-carried CV when its loop PHI is reloaded from memory +--EXTENSIONS-- +opcache +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=64M +opcache.jit=tracing +--CREDITS-- +Fabien Potencier and Symfony contributors +mercierj +--FILE-- +<?php + +// Reduced from Symfony Mime v7.4.13 CharacterStream (MIT). +// Copyright (c) Fabien Potencier and Symfony contributors. +// LICENSE (from https://github.com/symfony/mime/tree/v7.4.13): +// Copyright (c) 2010-present Fabien Potencier +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +final class Scanner { + private const MAP = ["a" => 1, "\xc3" => 2, "\xa9" => 0]; + + public static function scan(string $s): int { + $n = strlen($s); + $count = 0; + for ($i = 0; $i < $n; ++$i) { + $char = $s[$i]; + $size = self::MAP[$char]; + if ($size == 0) { + return -1; + } + for ($j = 1; $j < $size; ++$j) { + } + $i += $j - 1; + ++$count; + } + return $count; + } +} + +var_dump(Scanner::scan(str_repeat("a", 200) . "\xc3\xa9" . "aaa")); + +?> +--EXPECT-- +int(204)

« previous php.cvs (#142466) next »