Skip to content

php-in-php: drop isThinStandaloneAotMain libc fork from JitEnv putenv — always GetenvJitHelper + libc mirror (re-#20499) #21023

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, re-#20499 / peer getenv #20644 / rename #20603)

Problem

#20499 / #20500 moved putenv thin AOT off the StreamIo defer bag onto isThinStandaloneAotMain(), but thin standalone still takes a libc-only setenv path and skips GetenvJitHelper::putenv overlay. Peer StringGetenv already always NestedJITs the PHP helper under thin AOT (#20644). Thin user-script AOT therefore diverges from embed: overlay mutations and syntax ValueError path are skipped (guard also skipped for concat-temp SIGABRT history — #17316).

Path Today Target
Embed / non-thin syntax guard + GetenvJitHelper::putenv + libc mirror unchanged
Thin standalone AOT libc setenv only (no helper) helper + libc mirror (same as embed); NestedJIT leaf only inside helper compile if needed
putenvFromCStringLiteral thin libc only also overlay helper

php-src reference

PHP implementation target

  • ext/standard/JitEnv.php — delete isThinStandaloneAotMain early-return in putenv() / putenvFromCStringLiteral(); always StringGetenv::ensurePutenvLinked + GetenvJitHelper::putenv + emitLibcPutenvMirror
  • Keep emitLibcPutenvMirror (process environ for libc getenv readers — not C runtime growth)
  • test/unit/PutenvRuntimeShrinkTest.php — Rename/Getenv shape: no isThinStandaloneAotMain in JitEnv.php
  • Risk note: AOT: fix request_parse_body compile/link (#5965) #17316 concat/slot temp SIGABRT — if repro still red under thin AOT, leave precise blocker comment (do not force-merge)

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/PutenvRuntimeShrinkTest.php
vendor/bin/phpunit --filter putenv test/aot/AotTest.php
make bootstrap-selfhost-vm-driver-execute-probe
'

Done when

  • isThinStandaloneAotMain gone from JitEnv.php putenv paths
  • Thin + embed both use GetenvJitHelper::putenv + libc mirror
  • Putenv shrink + AOT putenv fixtures green; VM driver probe green
  • PR cites lines removed / no new runtime/*.c

Refs #1492, #20499, #20644, #17316, #10533

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