Category
php-in-php | stdlib | bootstrap
Problem
JIT (and AOT) currently reuse a hand-written native regex runtime:
lib/AOT/runtime/preg_match.c
That keeps PCRE semantics in C and blocks the PHP-in-PHP goal (#1492). This repo already has a PHP implementation surface in ext/standard/:
ext/standard/VmPreg.php
ext/standard/VmPregNative.php (FFI to libpcre2-8)
We should delete the C runtime helper (or shrink it to a minimal ABI shim) and lower preg_match()/friends via the PHP VM semantics so VM/JIT/AOT share one source of truth.
php-src reference
ext/pcre/php_pcre.c — preg_match, preg_match_all, preg_replace, preg_replace_callback, preg_last_error, preg_last_error_msg
Repro
test/repro-maintainer/preg_match_basic.php:
<?php
var_dump(preg_match('/a./', 'abc', $m));
var_export($m);
echo "\n";
Run:
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro-maintainer/preg_match_basic.php
php bin/vm.php test/repro-maintainer/preg_match_basic.php
php bin/jit.php test/repro-maintainer/preg_match_basic.php
'
Expected (Zend):
int(1)
array (
0 => 'ab',
)
Scope (this repo)
- Delete or shrink:
lib/AOT/runtime/preg_match.c
- VM SSOT:
ext/standard/VmPreg.php
ext/standard/VmPregNative.php
- JIT builtin lowering:
lib/JIT/Builtin/StringPregMatch.php should link/lower to the PHP path (no new C logic).
- Add compliance tests:
test/compliance/cases/stdlib/preg_match_basic.phpt
test/compliance/cases/stdlib/preg_last_error_msg.phpt
Done when
Related
Category
php-in-php|stdlib|bootstrapProblem
JIT (and AOT) currently reuse a hand-written native regex runtime:
lib/AOT/runtime/preg_match.cThat keeps PCRE semantics in C and blocks the PHP-in-PHP goal (#1492). This repo already has a PHP implementation surface in
ext/standard/:ext/standard/VmPreg.phpext/standard/VmPregNative.php(FFI to libpcre2-8)We should delete the C runtime helper (or shrink it to a minimal ABI shim) and lower
preg_match()/friends via the PHP VM semantics so VM/JIT/AOT share one source of truth.php-src reference
ext/pcre/php_pcre.c—preg_match,preg_match_all,preg_replace,preg_replace_callback,preg_last_error,preg_last_error_msgRepro
test/repro-maintainer/preg_match_basic.php:Run:
Expected (Zend):
Scope (this repo)
lib/AOT/runtime/preg_match.cext/standard/VmPreg.phpext/standard/VmPregNative.phplib/JIT/Builtin/StringPregMatch.phpshould link/lower to the PHP path (no new C logic).test/compliance/cases/stdlib/preg_match_basic.phpttest/compliance/cases/stdlib/preg_last_error_msg.phptDone when
preg_match.cfor semantics (file removed or reduced to a minimal ABI shim)./script/ci-fast.sh --filter preg_matchis greenRelated