Skip to content

php-in-php: drop Type::initialize always-on SessionStorageGlobals::ensureGlobals — lazy at session call sites (peer #34550) #34566

Description

@PurHur

Category

Foundation · php-in-php · runtime-shrink · cold-build / #32122 class

Problem

Type::initialize still eagerly SessionStorageGlobals::ensureGlobals on every full-load path after the CallArgv batch (#34550).

Always-on LLVM module globals (__phpc_session_id_storage, __phpc_session_name_storage, __phpc_session_active, …) on every full load for scripts that never touch session_* is leftover Type::initialize debt after the #32122 .1-mint shrink wave.

Call sites already ensure before use:

  • ext/standard/JitSessionStorageKernel.php / JitSessionLifecycleKernel.php / JitSessionStatus.php / JitSessionCacheExpire.php
  • lib/JIT/Builtin/SessionId.php / SessionName.php / SessionModuleName.php
  • SessionGcRuntime / SessionEncodeRuntime / SessionCreateIdRuntime
  • SessionStorageGlobals::emitCallEnsureDefaults / implementEnsureDefaults

php-src reference

PHP implementation target

Repro

./script/aot-smoke.sh
./script/docker-exec.sh -- bash -lc 'script/cold-build-check.sh'
./script/phpunit.sh --filter 'TypeDeadTypeInitializeLazySessionStorageGlobals|SessionStorageGlobalsStandalone|SessionStorageRuntimeShrink'
./script/docker-exec.sh -- bash -lc 'printf "%s\n" "<?php session_start(); echo session_id() !== \"\" ? \"ok\" : \"fail\", PHP_EOL;" >/tmp/ss.php && php bin/compile.php -o /tmp/ss.bin /tmp/ss.php && /tmp/ss.bin'

Done when

  • Type::initialize does not call SessionStorageGlobals::ensureGlobals
  • session_start / session_id still work under AOT (lazy ensureGlobals)
  • cold-build-check + aot-smoke 8/8 stay green
  • No new runtime/*.c

Parent

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