Skip to content

php-in-php: drop Context ensureMinimalUserStandaloneBodies always-on SuperglobalNameRuntime — lazy at JitSuperglobalName call sites #34812

Description

@PurHur

Category

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

Problem

Context::ensureMinimalUserStandaloneBodies() still eagerly NestedJIT/links SuperglobalNameRuntime on every thin AOT user-script init (hello-world / aot-smoke path), even when the script never calls __compiler_is_superglobal_name:

  • SuperglobalNameRuntime::ensureLinked → NestedJIT SuperglobalNameJitHelper

Measured on master @ current tip: nm on AOT echo "hi" shows T __compiler_is_superglobal_name and hundreds of SuperglobalNameJitHelper string consts — waste NestedJIT during init. Same always-on NestedJIT vs Runtime ABI drift / cold-build surface class as closed #34807 (EnvLocal) / #34769 / #34642. Leftover Context NestedJIT vs Runtime ABI drift mints is_superglobal_name.1 (#31894 / #32122).

Call sites already StringSuperglobalName::ensureLinked before lookup (ext/standard/JitSuperglobalName.php, lib/JIT.php compileSuperglobalNameNative). Compile-time PHP paths use Web\Superglobals::isSuperglobalName — not the LLVM ABI.

Repro Zend 8.2+ AOT thin hello-world
echo "hi"; (no is_superglobal) hi must not NestedJIT SuperglobalNameJitHelper during init
var_dump(__compiler_is_superglobal_name('_GET')); int(1) matches Zend via call-site ensureLinked

php-src reference

PHP implementation target

  • lib/JIT/Context.php ensureMinimalUserStandaloneBodies — remove SuperglobalNameRuntime::ensureLinked
  • Keep call-site StringSuperglobalName::ensureLinked / JitSuperglobalName
  • Keep CliArgvRuntime::ensureStandaloneBodies in minimal (argv still needed before {main})
  • 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 'echo '\''<?php echo "hi\n";'\'' > /tmp/hw.php && php bin/compile.php -o /tmp/hw.bin /tmp/hw.php && nm /tmp/hw.bin | grep -c SuperglobalNameJitHelper || true'

Done when

  • ensureMinimalUserStandaloneBodies does not call SuperglobalNameRuntime::ensureLinked
  • Thin hello-world AOT binary does not NestedJIT SuperglobalNameJitHelper (no __compiler_is_superglobal_name from eager init)
  • AOT __compiler_is_superglobal_name('_GET') still matches Zend via call-site ensureLinked
  • ./script/aot-smoke.sh still 8/8
  • Shrink unit test + peer keep-list updates

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