Skip to content

JIT: preg_replace_callback() compile-time string callbacks (#1177) - #1315

Merged
PurHur merged 1 commit into
masterfrom
agent/stdlib-preg-session-jit
May 24, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/stdlib-preg-session-jit

Conversation

@PurHur

@PurHur PurHur commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Wire preg_replace_callback() call() to JitPregReplaceCallback::invoke() for compile-time string user-function callbacks in the current compile unit.
  • Add an LLVM shim per callback so the linked __compiler_preg_replace_callback runtime receives __value__* (*)(__value__*) while user functions keep __string__* (*)(__hashtable__*) signatures.
  • Add JIT compliance PHPT and AOT fixture; sync docs/capabilities.md and docs/stdlib-jit-audit.md.
  • Remove session_id from SelfHostBuiltinPolicy VM-only deferred list (JIT already implemented on master).

Contributes to North Star 2 self-host (#1056) and stdlib wave 2 (#1237).

Closes #1177.

Test plan

  • php bin/vm.php smoke for preg_replace_callback compliance case
  • PHPUnit test/unit/PregReplaceCallbackBuiltinTest.php
  • ./script/ci-fast.sh in php-compiler:22.04-dev (tar pipe; harness bind-mount empty)
  • ./script/ci-local.sh full LLVM gate (MCJIT execution segfaults on this harness host for all JIT scripts; module verify passes for the new lowering)

Made with Cursor

Connect ext/standard call() to JitPregReplaceCallback via a per-callback LLVM
shim that adapts __value__* match vectors to user functions returning strings.
Add JIT/AOT PHPT coverage, sync capability matrix and stdlib JIT audit, and
drop session_id from the VM-only deferred list now that JIT is implemented.

Closes #1177. Contributes to #1056 and #1237.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 6c9a133 into master May 24, 2026
1 check failed
@PurHur
PurHur deleted the agent/stdlib-preg-session-jit branch June 2, 2026 03:31
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.

Stdlib: preg_replace_callback() — VM + LLVM JIT/AOT

1 participant