Skip to content

php-in-php: drop always-on Type __compiler_getenv / __compiler_getenv_all ABI shells (ext/standard/basic_functions.c) #32665

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #32651 / #32287 / re-#32122)

Problem

Builtin\Type::register() still addFunctions empty always-on shells for __compiler_getenv and __compiler_getenv_all on every JIT/AOT module. Runtime owners already declare the same prototypes module-locally with getNamedFunction first:

  • StringGetenv (__compiler_getenv) — GetenvLookupJitHelper / NestedJIT libc getenv(3)
  • StringGetenvAll (__compiler_getenv_all) — EnvironMirrorRuntime

A leftover Type addFunction vs Runtime ABI drift mints getenv.1 with no body (Module.php:180 / ld undefined name.1) — the #31894 / #32122 class. Empty Type decls were also mistaken for completed bodies and left U __compiler_getenv at argv-driver link (#26756).

Path Today Target
getenv body StringGetenv / JitEnv::getenv unchanged
getenv_all body StringGetenvAll / JitEnv::getenvAll unchanged
Type.php always-on empty shells drop both rows
NestedJIT consumers already ensureLinked before lookup keep + cite this issue
User-script getenv()/putenv() GetenvLookupJitHelper / PutenvJitHelper unchanged

php-src reference

PHP implementation target

  • lib/JIT/Builtin/Type.php — remove always-on __compiler_getenv / __compiler_getenv_all
  • ext/standard/JitEnv.php — already StringGetenv::ensureLinked / StringGetenvAll::ensureLinked before lookup
  • lib/JIT/Builtin/StringGetenv.php / StringGetenvAll.php — keep getNamedFunction-first owners

Repro

./script/docker-exec.sh -- bash -lc './script/aot-smoke.sh'
./script/docker-exec.sh -- bash -lc './script/cold-build-check.sh'

Done when

  • Type.php does not addFunction/registerFunction __compiler_getenv or __compiler_getenv_all
  • StringGetenv / StringGetenvAll still own the ABI (getNamedFunction first)
  • aot-smoke.sh stays 8/8
  • cold-build-check.sh ok
  • No new runtime/*.c

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