Category
language
Problem
PHP 8.1+ list assignment with spread ([$head, ...$tail] = $array) is VM-complete after #4835 (OpCode::TYPE_LIST_SPREAD_ASSIGN in lib/VM.php). lib/JIT.php has no case OpCode::TYPE_LIST_SPREAD_ASSIGN, so bin/jit.php / AOT cannot execute scripts using spread destructuring without VM fallback.
test/compliance/JITTest.php skips list_destructuring_spread.phpt for MCJIT execute.
php-src reference
Repro — VM (baseline, should already pass)
<?php
$src = [1, 2, 3, 4];
[$a, ...$rest] = $src;
echo $a, ':', implode(',', $rest), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro_list_spread.php'
# Expected: 1:2,3,4
Repro — JIT gap (today)
Same script via JIT:
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
export PHP_COMPILER_LLVM_PATH=/opt/llvm9
export LD_LIBRARY_PATH=/opt/llvm9
php bin/jit.php repro_list_spread.php
'
VM matches Zend; JIT compile/execute fails or diverges until TYPE_LIST_SPREAD_ASSIGN is lowered.
String-key tail guard (VM already enforces):
<?php
try {
[$a, ...$b] = ['k' => 1, 'x' => 2];
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
Zend: Cannot unpack array with string keys.
Scope (this repo)
| Area |
Files |
| JIT |
lib/JIT.php — case OpCode::TYPE_LIST_SPREAD_ASSIGN (reuse HashTable::sliceCopy / list unpack helpers) |
| Reference VM |
lib/VM.php lines ~1258–1286 |
| Compiler |
lib/Compiler.php — spread assign emission (~3676) |
| Tests |
test/compliance/cases/language/list_destructuring_spread.phpt; unskip in JITTest.php |
| Patches |
script/apply-patches.sh — listSpreadRhs php-cfg overlay (required for compile) |
Done when
Links
Category
languageProblem
PHP 8.1+ list assignment with spread (
[$head, ...$tail] = $array) is VM-complete after #4835 (OpCode::TYPE_LIST_SPREAD_ASSIGNinlib/VM.php).lib/JIT.phphas nocase OpCode::TYPE_LIST_SPREAD_ASSIGN, sobin/jit.php/ AOT cannot execute scripts using spread destructuring without VM fallback.test/compliance/JITTest.phpskipslist_destructuring_spread.phptfor MCJIT execute.php-src reference
Zend/zend_compile.c— list assignment with unpackZend/zend_execute.c—ZEND_ASSIGNlist unpack + remainder mergeRepro — VM (baseline, should already pass)
Repro — JIT gap (today)
Same script via JIT:
VM matches Zend; JIT compile/execute fails or diverges until
TYPE_LIST_SPREAD_ASSIGNis lowered.String-key tail guard (VM already enforces):
Zend:
Cannot unpack array with string keys.Scope (this repo)
lib/JIT.php—case OpCode::TYPE_LIST_SPREAD_ASSIGN(reuseHashTable::sliceCopy/ list unpack helpers)lib/VM.phplines ~1258–1286lib/Compiler.php— spread assign emission (~3676)test/compliance/cases/language/list_destructuring_spread.phpt; unskip inJITTest.phpscript/apply-patches.sh—listSpreadRhsphp-cfg overlay (required for compile)Done when
list_destructuring_spread.phptwithout VM fallbackTypeErrorwith Zend message./script/ci-fast.sh --filter list_destructuring_spreadgreen (VM + JIT)Links