Skip to content

Stdlib: str_replace() JIT/AOT lowering (#82)#240

Merged
PurHur merged 1 commit into
masterfrom
feat/stdlib-str-replace-jit-aot-v2
May 19, 2026
Merged

Stdlib: str_replace() JIT/AOT lowering (#82)#240
PurHur merged 1 commit into
masterfrom
feat/stdlib-str-replace-jit-aot-v2

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 19, 2026

Summary

  • Implements LLVM lowering for str_replace() via new JitStrReplace helper (strstr loop + slice + concat), matching the VM byte-safe algorithm in VmString::strReplace.
  • Wires ext/standard/str_replace.php call() for JIT/AOT; bin/compile.php already loads the standard module.
  • Adds str_replace_jit.phpt compliance coverage and test/fixtures/aot/cases/str_replace.phpt AOT fixture; updates docs/capabilities.md.

Closes the str_replace portion of #82 (implode / explode were already JIT/AOT-capable).

Test plan

  • php bin/vm.php / php bin/jit.php on str_replace('o','0','foo')f00
  • php bin/compile.php -o /tmp/out + run binary (LLVM + libjansson in dev image)
  • php script/capability-matrix.php --check
  • Local Docker CI: tar … | docker run … ./script/ci-local.sh (with libjansson4 for AOT link)

Made with Cursor

Add JitStrReplace using strstr, jitCopySlice, and JitStringConcat so
str_replace compiles on the static/AOT path used by bin/compile.php.
Includes JIT and AOT PHPT coverage and updates the capability matrix.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 2679aa4 into master May 19, 2026
1 check failed
@PurHur PurHur deleted the feat/stdlib-str-replace-jit-aot-v2 branch May 19, 2026 07:18
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.

1 participant