Skip to content

php-in-php: delete EnvironMirrorRuntimeUserScriptCstr — helper-runtime + libc native mirror (#19157) - #19168

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-environ-mirror-19157
Jul 15, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-environ-mirror-19157

Conversation

@PurHur

@PurHur PurHur commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Delete EnvironMirrorRuntimeUserScriptCstr.php (~182 LOC libc environ LLVM defer path) and route all user-script/embed paths through JitVmHelperLink + EnvironMirrorNativeJitHelper.
  • Init-safe mirror SSOT: VmEnvEnvironNative::mirrorIntoNativeHashtable() → phpc_native_environ_mirror_into_ht → shared EnvironLibcWalkJit (libc environ walk into native __hashtable__*).
  • Prelink ext/standard/EnvironMirrorNativeJitHelper.php helper-runtime unit for cold-start user-script AOT.

C runtime shrink

Removed Added
lib/JIT/Builtin/EnvironMirrorRuntimeUserScriptCstr.php (182 LOC dedicated defer LLVM) EnvironLibcWalkJit.php (shared JIT helper) + thin phpc_native_environ_mirror_into_ht internal

Net: dedicated user-script-only defer branch deleted; libc walk consolidated behind PHP internal callable from compiled helper.

php-src reference

  • sapi/cli/php_cli.c — copy environ into superglobals on CLI startup

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php vendor/bin/phpunit test/unit/EnvironMirrorRuntimeShrinkTest.php'
# PHPUnit 9.6.21 — OK (6 tests, 16 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && echo "<?php echo \"hi\";" > /tmp/hi.php && PHP_COMPILER_AOT_USER_SCRIPT=1 php bin/compile.php -o /tmp/hi_bin /tmp/hi.php && /tmp/hi_bin; echo exit=$?'
# phpc build: helper-runtime cache hit (1 helpers, core=b868f1cb704c8fe544e6)
# hi
# exit=0

make bootstrap-selfhost-vm-driver-execute-probe
# bootstrap-selfhost-vm-driver-execute-probe: OK

Closes #19157

Made with Cursor

…e + libc native mirror (#19157)

Route all environ mirror paths through JitVmHelperLink + EnvironMirrorNativeJitHelper
with init-safe phpc_native_environ_mirror_into_ht (libc walk SSOT in EnvironLibcWalkJit).
Removes ~182 LOC UserScriptCstr defer branch; prelinks helper-runtime unit.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant