Skip to content

php-in-php: gate Context::ensureFullStandaloneBodies string helpers on isThinStandaloneAotMain / isStandaloneInitPhase (#1492) #20571

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #20553 / #20533 / #20420)

Problem

Context::ensureFullStandaloneBodies still gates NestedJIT string-helper ensureStandaloneBodies on StreamIoRuntime::shouldDeferHeavyStreamIoEmitters() (M3 inventory + bootstrap-aot-link + standalone init bag). Peer builtins already use the narrower thin-standalone / init-phase gates (#20553). This is the last Context call site of the broad StreamIo defer bag — removing it lets StreamIoJit keep M3-only defer without Context coupling.

Mode Today Target
Full standalone Context init skip string helpers via shouldDeferHeavyStreamIoEmitters (always true in init phase) skip via isStandaloneInitPhase() (same observable)
Thin / user-script AOT N/A (ensureMinimalUserStandaloneBodies) unchanged
Outside init / non-thin ensure string helper bodies unchanged (!isThinStandaloneAotMain() && !isStandaloneInitPhase())

php-src reference

PHP implementation target

  • lib/JIT/Context.php — replace !StreamIoRuntime::shouldDeferHeavyStreamIoEmitters($this) with !$this->isThinStandaloneAotMain() && !StreamIoRuntime::isStandaloneInitPhase()
  • test/unit/ContextStandaloneBodiesRuntimeShrinkTest.php (new) — guard no shouldDeferHeavyStreamIoEmitters in Context; assert thin/init-phase gates

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/ContextStandaloneBodiesRuntimeShrinkTest.php \
  test/unit/ExamplesHelloWorldAotRegressionTest.php --filter testContextMinimal
make bootstrap-selfhost-vm-driver-execute-probe
'

Done when

  • Context.php has no shouldDeferHeavyStreamIoEmitters call
  • String-helper gate uses isThinStandaloneAotMain + isStandaloneInitPhase
  • Shrink unit test green
  • make bootstrap-selfhost-vm-driver-execute-probe green
  • PR body cites defer-gate lines removed

Refs #1492, #20553, #20533, #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