Skip to content

php-in-php: phpversion/php_uname/extension_loaded — delete phpc_info.c (~400 lines), VM+JIT from ext/standard #6124

Description

@PurHur

Category

php-in-php | stdlib | runtime

Problem

Introspection builtins (phpversion, php_sapi_name, php_uname, version_compare, extension_loaded, get_loaded_extensions) split between PHP ext/standard/*.php VM handlers and a ~400-line C translation unit linked for JIT/AOT:

  • lib/AOT/runtime/phpc_info.c (registered in lib/AOT/Linker.php)
  • lib/JIT/Builtin/StringInfo.php bitcode link
  • ext/standard/JitInfo.php LLVM lowering

Self-host M5 should execute these from compiled PHP in ext/standard/, not maintain parallel C string tables.

php-src reference

Repro (C runtime today)

./script/docker-exec.sh -- bash -lc 'wc -l lib/AOT/runtime/phpc_info.c
grep phpc_info lib/AOT/Linker.php
grep -l phpc_info lib/JIT/Builtin/*.php ext/standard/JitInfo.php'

VM path already works for basic calls:

./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r "var_export(version_compare(\"8.3.0\",\"8.2.0\",\">\"));"'

JIT/AOT still require phpc_info.c symbols until lowered from PHP.

Scope (this repo)

Done when

  • JIT + AOT compile/link without phpc_info.c (grep clean)
  • ~400 lines removed from lib/AOT/runtime/ (note in PR body)
  • Existing compliance / AOT PHPT for phpversion, version_compare, extension_loaded stay green
  • script/capability-matrix.php regeneration shows JIT/AOT yes without C fallback notes

Verification

./script/docker-exec.sh -- bash -lc '! grep -r phpc_info lib/AOT/Linker.php lib/JIT/Builtin/StringInfo.php 2>/dev/null || test $? -eq 1'
./script/docker-exec.sh -- vendor/bin/phpunit --filter 'Phpversion|VersionCompare|ExtensionLoaded'
make bootstrap-selfhost-link  # smoke when JIT symbols change

Pairs with parity issues #5817, #5955; advances #1492 PHP-in-PHP shrink-C-runtime goal.

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