Skip to content

php-in-php: delete EnvironMirrorRuntimeUserScriptCstr — route defer through HelperRuntimeCache + EnvironMirrorNativeJitHelper PHP (#1492) #19157

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492)

Problem

lib/JIT/Builtin/EnvironMirrorRuntimeUserScriptCstr.php (~182 LOC) hand-lowers a libc environ walk for user-script AOT when UserScriptAotDeferNestedJit is active (#15417, #18984). #19006 / helper-runtime cache (PHP_COMPILER_HELPER_RUNTIME_O=1 in bin/compile.php) now prelinks EnvironMirrorNativeJitHelper without nested-JIT during init — same pattern that made ProcessExecCaptureNativeJitHelper AOT-safe.

php-src reference

PHP implementation target

  • lib/JIT/Builtin/EnvironMirrorRuntime.php — drop defer→UserScriptCstr branch; always JitVmHelperLink + EnvironMirrorNativeJitHelper
  • Delete lib/JIT/Builtin/EnvironMirrorRuntimeUserScriptCstr.php
  • SSOT: ext/standard/EnvironMirrorNativeJitHelper.php + VmEnvEnvironNative::enumerate()

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php vendor/bin/phpunit test/unit/EnvironMirrorRuntimeShrinkTest.php'
echo '<?php echo getenv("PATH") !== false ? "ok" : "fail";' > /tmp/env.php
PHP_COMPILER_AOT_USER_SCRIPT=1 php bin/compile.php -o /tmp/env_bin /tmp/env.php && /tmp/env_bin

Done when

  • EnvironMirrorRuntimeUserScriptCstr.php deleted (~182 LLVM/libc lines)
  • EnvironMirrorRuntimeShrinkTest updated
  • User-script AOT smoke green; make bootstrap-selfhost-vm-driver-execute-probe green

Refs #1492, #18984, #15417, #19006

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