Skip to content

php-in-php: delete StringFileGetContentsLibc — user-script AOT via JitVmHelperLink + FileGetContentsJitHelper PHP (#1492) #19279

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, same pattern as #19186 unlink / #19215 rename)

Problem

lib/JIT/Builtin/StringFileGetContents.php still routes UserScriptAotDeferNestedJit::shouldDefer() through StringFileGetContentsLibc (~211 LOC hand-written libc open/read LLVM). Embed/full JIT already uses FileGetContentsJitHelper → VmFs::fileGetContents(). FileGetContentsJitHelper is already present in prelinked/helper-runtime/.../units (same cache Unlink used successfully after #19186).

php-src reference

PHP implementation target

  • lib/JIT/Builtin/StringFileGetContents.php — always JitVmHelperLink::ensureBridge (drop defer → Libc early-return)
  • Delete lib/JIT/Builtin/StringFileGetContentsLibc.php
  • Update test/unit/FileGetContentsRuntimeShrinkTest.php + spine require list
  • Keep SSOT: ext/standard/FileGetContentsJitHelper.php → VmFs::fileGetContents()

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/FileGetContentsRuntimeShrinkTest.php
vendor/bin/phpunit test/aot/AotTest.php --filter "data set \\\"file_get_contents\\\""
tmpdir=$(mktemp -d)
echo hi > "$tmpdir/x"
php bin/compile.php -o "$tmpdir/fgc" -r "echo file_get_contents(\"$tmpdir/x\");"
"$tmpdir/fgc"
'

Done when

  • StringFileGetContentsLibc.php deleted
  • UserScriptAotDeferNestedJit removed from StringFileGetContents bridge path
  • AOT file_get_contents fixture green
  • make bootstrap-selfhost-vm-driver-execute-probe green
  • PR body cites lines removed

Refs #1492, #15309, #17036, #19186

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 & DevEx

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions