Skip to content

php-in-php: JIT StringPhpinfoRuntime — route phpinfo()/phpcredits() through VmInfo PHP not __compiler_phpinfo LLVM (#1492) #9256

Description

@PurHur

Category

php-in-php · stdlib · shrink C/LLVM builtins · php-src-strict

Problem

phpinfo() / phpcredits() VM logic lives in ext/standard/VmInfo.php (PHP SSOT), but JIT/AOT still emit HTML via lib/JIT/Builtin/StringPhpinfoRuntime.php (~344 lines) calling __compiler_phpinfo / __compiler_phpcredits with duplicated LLVM string tables.

This duplicates Zend phpinfo() output assembly already modeled in PHP and blocks #1492 runtime shrink.

php-src reference

Repro (failure / drift today)

Save as test/repro/maintainer_gap_phpinfo_jit.php:

<?php
declare(strict_types=1);
ob_start();
phpinfo(INFO_GENERAL);
$vm = ob_get_clean();
echo strlen($vm), "\n";
echo str_contains($vm, 'PHP Version') ? "has_version\n" : "missing_version\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
wc -l lib/JIT/Builtin/StringPhpinfoRuntime.php ext/standard/VmInfo.php
php test/repro/maintainer_gap_phpinfo_jit.php
php bin/jit.php test/repro/maintainer_gap_phpinfo_jit.php 2>&1
grep -n StringPhpinfoRuntime lib/JIT/Builtin/Type.php | head
'
Path Expected
VM non-empty HTML containing PHP Version
JIT same length band + same key sections as VM (no __compiler_phpinfo divergence)

Scope (this repo)

Layer Path
JIT shrink lib/JIT/Builtin/StringPhpinfoRuntime.php — delete HTML table LLVM
PHP SSOT ext/standard/VmInfo.php — shared by VM + JIT trampoline
Registration lib/JIT/Builtin/Type.php ensureLinked hook
Tests extend test/compliance/cases/stdlib/phpinfo*.phpt if present

Do not grow runtime/*.c. Remove __compiler_phpinfo symbols when PHP path links.

Done when

  • JIT phpinfo() / phpcredits() invoke compiled VmInfo PHP (no standalone LLVM HTML builder)
  • VM + JIT output match Zend for INFO_GENERAL section keys (php-src-strict)
  • StringPhpinfoRuntime.php shrinks to thin trampoline or is deleted; PR cites lines removed
  • ./script/ci-fast.sh --filter Phpinfo or targeted compliance subset green

Verification

make bootstrap-selfhost-vm-driver-execute-probe
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter Phpinfo'

Related

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 / JITenhancementNew 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 appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions