Category
php-in-php · php-src-strict runtime semantics
Problem
strtok() VM semantics live in ext/standard/strtok.php / VmString::strtok(), but JIT/AOT still link lib/JIT/Builtin/StringStrtokJit.php (~480 lines) emitting phpc_strtok / __phpc_strtok_* LLVM with a fixed 64KiB global buffer — duplicating PHP logic and blocking C-runtime shrink.
php-src reference
Repro (parity guard)
Save as test/repro/maintainer_strtok_jit_parity.php:
<?php
$s = "a,b,c";
echo strtok($s, ","), "\n";
echo strtok(","), "\n";
echo strtok(","), "\n";
echo var_export(strtok(","), true), "\n";
strtok("x:y", ":");
echo strtok(":"), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/maintainer_strtok_jit_parity.php
php bin/vm.php test/repro/maintainer_strtok_jit_parity.php
php bin/jit.php test/repro/maintainer_strtok_jit_parity.php
'
VM today matches Zend; JIT/AOT must call the same PHP helper after migration (no second strtok walk in LLVM).
Scope (this repo)
| Path |
Work |
ext/standard/StrtokJitHelper.php (new) or extend JitStrtok.php |
Compiled PHP SSOT callable from JIT bridge |
lib/JIT/Builtin/StringStrtokJit.php |
Thin ABI: delegate to helper; delete buffer/table LLVM |
lib/JIT/Builtin/JitStrtok.php |
Wire bridge |
| AOT standalone link |
Prefer compiled helper over phpc_strtok symbol |
| Tests |
test/compliance/cases/stdlib/strtok_jit.phpt |
Done when
Related
Category
php-in-php· php-src-strict runtime semanticsProblem
strtok()VM semantics live inext/standard/strtok.php/VmString::strtok(), but JIT/AOT still linklib/JIT/Builtin/StringStrtokJit.php(~480 lines) emittingphpc_strtok/__phpc_strtok_*LLVM with a fixed 64KiB global buffer — duplicating PHP logic and blocking C-runtime shrink.php-src reference
ext/standard/string.c—PHP_FUNCTION(strtok), reentrant statelib/AOT/runtime/phpc_strtok.c(removed; LLVM reimplemented in PHP repo)Repro (parity guard)
Save as
test/repro/maintainer_strtok_jit_parity.php:VM today matches Zend; JIT/AOT must call the same PHP helper after migration (no second strtok walk in LLVM).
Scope (this repo)
ext/standard/StrtokJitHelper.php(new) or extendJitStrtok.phplib/JIT/Builtin/StringStrtokJit.phplib/JIT/Builtin/JitStrtok.phpphpc_strtoksymboltest/compliance/cases/stdlib/strtok_jit.phptDone when
StringStrtokJit.phpshrinks to bridge-only (target: −400+ LLVM lines)lib/AOT/runtime/*.c./script/ci-fast.sh --filter strtokgreen (or targeted PHPUnit filter above)Related