Skip to content

php-in-php: route similar_text() JIT through SimilarTextJitHelper PHP (#9731) - #9739

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-similar-text-9731
Jun 18, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-similar-text-9731

Conversation

@PurHur

@PurHur PurHur commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ext/standard/SimilarTextJitHelper.php delegating to VmString::similar_text() (php-src ext/standard/string.c).
  • Move JIT/AOT phpc_similar_text bridge into StringSimilarText.php; shrink StringSimilarTextJit.php from 420 → 17 lines (96% LLVM emitter removed — compat shim only).
  • Add shrink + standalone inventory guards; wire SimilarTextJitHelper into self-host spine.

C runtime shrink

File Before After Δ
lib/JIT/Builtin/StringSimilarTextJit.php 420 17 −403
lib/JIT/Builtin/StringSimilarText.php 23 123 +100 (thin bridge)
Net −297 lines

Deleted LLVM symbols: __phpc_similar_str, __phpc_similar_char, hand-written phpc_similar_text Oliver loops.

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter SimilarText'
# OK (11 tests, 25 assertions)

make bootstrap-selfhost-vm-driver-execute-probe
# bootstrap-selfhost-vm-driver-execute-probe: OK

php script/check-selfhost-spine-coverage-sync.php
# check-selfhost-spine-coverage-sync: OK

Closes #9731

Made with Cursor

Replace ~420-line LLVM Oliver algorithm with thin char* bridges into VmString::similar_text; StringSimilarTextJit shrinks to a compat shim.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 5178a64 into master Jun 18, 2026
@PurHur
PurHur deleted the agent/runtime-php-similar-text-9731 branch June 18, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

php-in-php: JIT StringSimilarTextJit — route similar_text() through VmString PHP not ~420-line LLVM (#1492)

1 participant