Skip to content

php-in-php: lazy Assert/Gc/Progress/Trigger/ReturnPending/LastError from ensureFullStandaloneBodies (Context.php) #35073

Description

@PurHur

Category

php-in-php · runtime-shrink · Pillar Trust (#32122 .1 mint class)

Problem

Context::ensureFullStandaloneBodies still eagerly NestedJITs assert / GC / progress / trigger_error / return-pending / last-error ABIs during every full standalone init — peers already made these lazy on the minimal path (#34605 / #34621 / #34631 / #34641 / AssertOptions #34463):

  1. StringTriggerError (called twice) + AssertFail + AssertOptionsRuntime
  2. JitReturnPending
  3. LastErrorRuntime / ProgressNoteRuntime / GcToggleRuntime / GcCollectCyclesRuntime

Leftover Context NestedJIT vs Runtime ABI drift mints *.1 (#31894 / #32122). Call sites already ensureLinked before lookup; AssertFail::ensureLinked must implement bodies for standalone (today it only declares empty ABI — peer AssertOptions).

php-src reference

PHP implementation target

  • lib/JIT/Builtin/AssertFail.phpensureLinked always implements bodies + StringTriggerError::ensureLinked (php-in-php: drop leftover Type always-on __compiler_trigger_error ABI shell (Zend/zend_execute_API.c) #33234); restore insert block
  • lib/JIT/Builtin/JitReturnPending.phpensureLinked registers decls before implement
  • lib/JIT/Context.php — drop the always-on ensureStandaloneBodies calls from ensureFullStandaloneBodies; compileToFile ensureLinked before clear-return-pending
  • Guard unit test peer ContextFullStandaloneLazyJsonOffsetShrinkTest
  • Update minimal-path tests that still require full to keep these
  • No new runtime/*.c

Repro / verify

./script/aot-smoke.sh
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_HELPER_RUNTIME_O=0 php bin/compile.php -o /tmp/hw.bin -r "echo \"hi\";" && /tmp/hw.bin'
./script/phpunit.sh --filter 'ContextFullStandaloneLazyAssertGc|ContextMinimalStandaloneLazyDomGc|ContextMinimalStandaloneLazyStringTrigger|ContextMinimalStandaloneLazyLastError|ContextMinimalStandaloneLazyReturnPending|TypeDeadTriggerErrorAbi'

Done when

  • ensureFullStandaloneBodies no longer eagerly NestedJITs TriggerError / AssertFail / AssertOptions / ReturnPending / LastError / ProgressNote / Gc*
  • AssertFail::ensureLinked implements standalone bodies (call-site safe)
  • ./script/aot-smoke.sh stays 8/8
  • No new lib/AOT/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