Skip to content

php-in-php: drop Context ensureMinimalUserStandaloneBodies always-on CliArgvRuntime — lazy at CliArgvGlobalInit / compileToFile (#32122 class) #34822

Description

@PurHur

Category

Foundation · php-in-php · runtime-shrink · cold-build / #32122 class

Problem

Context::ensureMinimalUserStandaloneBodies() still eagerly CliArgvRuntime::ensureStandaloneBodies on every thin AOT user-script init (hello-world / aot-smoke path), even though:

  • compileToFile already CliArgvRuntime::ensureStandaloneBodies before __phpc_cli_store_argv for thin standalone
  • CliArgvGlobalInit::{load,loadArgc,emitRefreshAfterStoreArgv} already CliArgvRuntime::ensureLinked before lookup
  • JitGetopt already CliArgvRuntime::ensureLinked

Always-on during init is the same leftover NestedJIT / ABI-link surface class as closed #34812 (SuperglobalName) / #34807 (EnvLocal). Mid-{main} ensureLinked without insert-block restore orphans calls / fails Module.php:180 (#27317 / #34812).

CliArgvRuntime no longer NestedJITs CliArgvJitHelper (pure LLVM refresh); keep ABI in the binary via compileToFile + call sites — just not during ensureMinimal init.

Repro Zend 8.2+ AOT thin hello-world
echo "hi"; (no $argv) hi must not eagerly link CliArgv during ensureMinimal
echo $argc; 1 matches Zend via call-site / compileToFile ensureLinked

php-src reference

PHP implementation target

  • lib/JIT/Context.php ensureMinimalUserStandaloneBodies — remove CliArgvRuntime::ensureStandaloneBodies
  • lib/JIT/Builtin/CliArgvRuntime.php — save/restore insert block on implement() (peer MetaTags #27317 / #34812)
  • Keep compileToFile thin ensure + ensureFullStandaloneBodies / bootstrap-aot
  • Update peer shrink keep-lists + unit shrink test
  • ./script/aot-smoke.sh 8/8

Repro

./script/aot-smoke.sh
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
echo '\''<?php echo "hi\n";'\'' > /tmp/hw.php
php bin/compile.php -o /tmp/hw.bin /tmp/hw.php && /tmp/hw.bin
echo '\''<?php echo $argc, "\n";'\'' > /tmp/av.php
php bin/compile.php -o /tmp/av.bin /tmp/av.php && /tmp/av.bin'

Done when

  • ensureMinimalUserStandaloneBodies does not call CliArgvRuntime::ensureStandaloneBodies
  • Thin hello-world / $argc AOT still match Zend; aot-smoke 8/8
  • Mid-{main} $argv ensureLinked restores insert block (no Module.php:180)
  • Shrink unit test + peer keep-list updates
  • No new lib/AOT/runtime/*.c

Parent / peers

  • #32122 cold-build / *.1 mint class
  • #34812 SuperglobalName; #34807 EnvLocal; #34463 Type CliArgv

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