Skip to content

php-in-php: version_compare() — delete phpc_version_compare.c (~248 lines), JIT/AOT via VmInfo (pairs #5492) #6277

Description

@PurHur

Category

php-in-php | stdlib | runtime

Problem

version_compare() VM logic already lives in PHP (ext/standard/VmInfo.php, ext/standard/version_compare.php), but JIT/AOT still link a separate ~248-line C translation unit lib/AOT/runtime/phpc_version_compare.c (registered in lib/AOT/Linker.php, called from ext/standard/JitInfo.php via __compiler_version_compare).

Self-host M5 should not maintain duplicate version-string canonicalization in C when VmInfo::version_compare() is the SSOT. Issue #5492 tracks phpc_info.c; this file is a second C runtime copy that must be deleted in the same PHP-in-PHP pass.

php-src reference

Repro (C runtime still linked)

./script/docker-exec.sh -- bash -lc 'wc -l lib/AOT/runtime/phpc_version_compare.c
rg -n phpc_version_compare lib/AOT/Linker.php ext/standard/JitInfo.php'

Today: 248 lib/AOT/runtime/phpc_version_compare.c + __compiler_version_compare symbol in AOT link set.

Compare with PHP SSOT:

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "var_export(version_compare(\"1.0\",\"1.0.0\")); echo PHP_EOL;"'
# int(0)

Enum operand strictness is tracked separately in #5955 (php-src-strict TypeError) — wire the same guards in JIT lowering when deleting C.

Scope (this repo)

Layer Path
PHP SSOT ext/standard/VmInfo.php, ext/standard/version_compare.php
JIT ext/standard/JitInfo.php — lower via PHP helper / shared IR, not __compiler_version_compare
AOT remove lib/AOT/runtime/phpc_version_compare.c from lib/AOT/Linker.php
C shrink delete file + symbol; no new logic in runtime/*.c

Done when

Links

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITarea:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions