Category
php-in-php
Problem
Natural-order string compares are implemented in ext/standard/ for VM (strnatcmp.php, strnatcasecmp.php, VmString), but JIT/AOT still pull in separate C files:
lib/AOT/runtime/phpc_strnatcmp.c (~72 lines)
lib/AOT/runtime/phpc_strnatcasecmp.c (~83 lines)
Zend reference is PHP-level string comparison; no need for permanent C tables.
php-src reference
Scope (this repo)
- Delete both
.c files; drop from lib/AOT/Linker.php
- JIT: lower to
VmString natural-order helpers (or inline LLVM from PHPlowering)
- Keep VM semantics in
ext/standard/strnatcmp.php / strnatcasecmp.php
Repro
<?php var_export(strnatcmp('2', '10'));
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
cd /compiler
php repro.php # expect: -1
php bin/vm.php repro.php
'
Both already print -1 today; acceptance is link without C + JIT/AOT parity.
Done when
- C files removed; targeted tests green
- PR notes ~155 lines deleted from
lib/AOT/runtime/
Category
php-in-phpProblem
Natural-order string compares are implemented in
ext/standard/for VM (strnatcmp.php,strnatcasecmp.php,VmString), but JIT/AOT still pull in separate C files:lib/AOT/runtime/phpc_strnatcmp.c(~72 lines)lib/AOT/runtime/phpc_strnatcasecmp.c(~83 lines)Zend reference is PHP-level string comparison; no need for permanent C tables.
php-src reference
ext/standard/string.c—PHP_FUNCTION(strnatcmp),PHP_FUNCTION(strnatcasecmp)Scope (this repo)
.cfiles; drop fromlib/AOT/Linker.phpVmStringnatural-order helpers (or inline LLVM from PHPlowering)ext/standard/strnatcmp.php/strnatcasecmp.phpRepro
Both already print
-1today; acceptance is link without C + JIT/AOT parity.Done when
lib/AOT/runtime/