Category
php-in-php | stdlib
Problem
similar_text() has a PHP VM implementation (ext/standard/similar_text.php, VmString::similarText), but JIT/AOT standalone still lowers through lib/JIT/Builtin/StringSimilarTextJit.php (~420 lines of hand-written LLVM). This duplicates logic already expressible in PHP and blocks self-host shrinking of emit-helper C/LLVM tables.
php-src reference
Repro (LLVM path active today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "echo similar_text(\"hello\", \"hallo\", \$p), \" \", \$p, PHP_EOL;" # VM PHP path OK
wc -l lib/JIT/Builtin/StringSimilarTextJit.php'
# StringSimilarTextJit.php ~420 lines; AOT standalone links LLVM symbol __compiler_similar_text
Standalone inventory includes StringSimilarTextJit.php on bootstrap spine (docs/bootstrap-inventory.md).
Scope (this repo)
| Piece |
Path |
| PHP helper |
ext/standard/SimilarTextJitHelper.php (new) wrapping VmString::similarText |
| JIT entry |
replace StringSimilarTextJit::implement body with PHP trampoline |
| Delete/shrink |
lib/JIT/Builtin/StringSimilarTextJit.php LLVM emitter |
| Tests |
existing test/compliance/cases/stdlib/similar_text*.phpt; test/unit/JIT/*SimilarText* |
Done when
Links
Pattern: #9496 (CtypeJitHelper), #9626 (PregReplacementExpand) · #1492
Category
php-in-php|stdlibProblem
similar_text()has a PHP VM implementation (ext/standard/similar_text.php,VmString::similarText), but JIT/AOT standalone still lowers throughlib/JIT/Builtin/StringSimilarTextJit.php(~420 lines of hand-written LLVM). This duplicates logic already expressible in PHP and blocks self-host shrinking of emit-helper C/LLVM tables.php-src reference
ext/standard/string.c—php_similar_text()ext/standard/similar_text.phpin this repoRepro (LLVM path active today)
Standalone inventory includes
StringSimilarTextJit.phpon bootstrap spine (docs/bootstrap-inventory.md).Scope (this repo)
ext/standard/SimilarTextJitHelper.php(new) wrappingVmString::similarTextStringSimilarTextJit::implementbody with PHP trampolinelib/JIT/Builtin/StringSimilarTextJit.phpLLVM emittertest/compliance/cases/stdlib/similar_text*.phpt;test/unit/JIT/*SimilarText*Done when
similar_text()output matches VM/Zend (percent + optional by-ref)StringSimilarTextJit.phpLLVM line count reduced ≥80% (thin trampoline only)test/unit/AotRuntimeInventoryTest.php/ runtime shrink tests updated./script/ci-fast.sh --filter similar_textgreenLinks
Pattern: #9496 (CtypeJitHelper), #9626 (PregReplacementExpand) · #1492