Skip to content

php-in-php: drop shouldDeferHeavyStreamIoEmitters from StreamRead/Lifecycle/Bucket/Filter — thin via isThinStandaloneAotMain (#1492) #20553

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #20533 / #20521 / #20308)

Problem

StreamReadRuntime, JitStreamLifecycleKernel, JitStreamBucketKernel, and JitStreamFilterKernel still gate inventory/thin deferred stubs on StreamIoRuntime::shouldDeferHeavyStreamIoEmitters() (M3 inventory + NestedJit defer bag + UserScriptAotEnv). Peer builtins already use Context::isThinStandaloneAotMain() for the same thin-standalone constraint (#16075).

Separately, ExamplesHelloWorldAotRegressionTest::testStreamIoDefersNestedJitForUserScriptAot is already red on master: it asserts the literal PHP_COMPILER_AOT_USER_SCRIPT string inside StreamIoRuntime.php, but that file routes through UserScriptAotEnv / isThinStandaloneAotMain after #20229.

Mode Today Target
Embed / non-thin NestedJIT helpers unchanged
User-script / bootstrap thin AOT shouldDeferHeavyStreamIoEmitters → deferred stubs isThinStandaloneAotMain() → same stubs
Inventory emit / M3 driver deferred via StreamIo defer bag NestedJIT when not thin-standalone
Full standalone Context init stubs via standaloneInitPhase inside defer bag keep stubs via StreamIoRuntime::isStandaloneInitPhase() (narrow; not the M3 bag)

php-src reference

PHP implementation target

  • lib/JIT/Builtin/StreamReadRuntime.php — shouldDeferInventoryEmitStubs → isThinStandaloneAotMain() \|\| isStandaloneInitPhase()
  • ext/standard/JitStreamLifecycleKernel.php / JitStreamBucketKernel.php / JitStreamFilterKernel.php — same gate; drop shouldDeferHeavyStreamIoEmitters call sites
  • lib/JIT/Builtin/StreamIoRuntime.php — add public isStandaloneInitPhase(); remove redundant UserScriptAotEnv from shouldDeferHeavyStreamIoEmitters (thin callers already use isThinStandaloneAotMain)
  • Shrink tests + fix ExamplesHelloWorldAotRegressionTest::testStreamIoDefersNestedJitForUserScriptAot

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/StreamReadRuntimeShrinkTest.php \
  test/unit/StreamLifecycleRuntimeShrinkTest.php \
  test/unit/StreamBucketKernelShrinkTest.php \
  test/unit/StreamFilterKernelShrinkTest.php \
  test/unit/StreamIoRuntimeShrinkTest.php \
  test/unit/ExamplesHelloWorldAotRegressionTest.php
make bootstrap-selfhost-vm-driver-execute-probe
'

Done when

  • No shouldDeferHeavyStreamIoEmitters in StreamRead / Lifecycle / Bucket / Filter kernels
  • Thin path gated on isThinStandaloneAotMain (+ init-phase only where Context still installs inventory stubs)
  • HelloWorld StreamIo assertion green (assert thin/UserScriptAotEnv shape, not raw getenv string in StreamIoRuntime)
  • make bootstrap-selfhost-vm-driver-execute-probe green
  • PR body cites defer-gate lines removed

Refs #1492, #20533, #20521, #20308, #20229, #16075

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