Skip to content

php-in-php: JIT StringEnvLocal — route putenv/getenv overlay through VmEnv PHP not ~440-line LLVM (#1492) #9814

Description

@PurHur

Category

php-in-php · php-src-strict

Problem

Process-local environment overlay for putenv() / getenv() is implemented in PHP (ext/standard/VmEnv.php), but JIT/AOT still link lib/JIT/Builtin/StringEnvLocal.php (~440 lines) reimplementing phpc_env_local_* hashtable logic in LLVM (replaces deleted lib/AOT/runtime/phpc_env_local.c).

CGI/superglobal refresh and self-host probes depend on consistent env semantics across VM/JIT/AOT.

php-src reference

Repro

Save as test/repro/maintainer_putenv_getenv_jit.php:

<?php
putenv('PHPC_TEST_ENV=1');
var_export(getenv('PHPC_TEST_ENV'));
echo "\n";
putenv('PHPC_TEST_ENV');
var_export(getenv('PHPC_TEST_ENV'));
echo "\n";
putenv('PHPC_TEST_ENV=2');
var_export(getenv('PHPC_TEST_ENV'));
echo "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_putenv_getenv_jit.php
php bin/jit.php test/repro/maintainer_putenv_getenv_jit.php
'
Step Zend VM today JIT today (gap)
set + get '1' OK must match after migration
unset via putenv('NAME') false OK must match
reset '2' OK must match

Scope

Path Work
ext/standard/EnvLocalJitHelper.php (new) Bridge calling VmEnv overlay SSOT
lib/JIT/Builtin/StringEnvLocal.php Thin ABI; delete 256-entry LLVM table
lib/JIT/Builtin/JitEnv.php (if present) Wire helper
Tests test/compliance/cases/stdlib/putenv_getenv_jit.phpt

Done when

  • JIT/AOT repro matches VM/Zend
  • StringEnvLocal.php bridge-only (−350+ LLVM lines)
  • No resurrection of phpc_env_local.c
  • ./script/ci-fast.sh --filter putenv_getenv green

Related

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 & DevExphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions