Skip to content

php-in-php: drop Context ensureMinimalUserStandaloneBodies always-on LastErrorRuntime — lazy at error_get_last/trigger_error (peer #34621) #34631

Description

@PurHur

Category

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

Problem

Context::ensureMinimalUserStandaloneBodies() still eagerly NestedJIT/links LastErrorRuntime on every thin AOT user-script init (hello-world / aot-smoke path), even when the script never calls error_get_last / error_clear_last:

  • LastErrorRuntime::ensureStandaloneBodies → NestedJIT ErrorLastJitHelper + __phpc_last_error_* bridges (ends with clearInsertionPosition())

Same always-on NestedJIT vs Runtime ABI drift / cold-build surface class as closed #34621 / #34612 / #34605 / #32122 .1-mint risk.

Call sites already ensure before use:

  • ext/standard/JitErrorGetLast.phpinvoke / clearLastErrorRuntime::ensureLinked
  • ext/standard/JitTriggerErrorKernel.phpimplementLastErrorRuntime::ensureLinked (also covers thin init when StringTriggerError stays always-on)

LastErrorRuntime::implement must capture/restore builder insert (peer JitHelperAbiBridge / #34621) so mid-{main} ensureLinked is safe — today it always clearInsertionPosition().

php-src reference

PHP implementation target

  • lib/JIT/Builtin/LastErrorRuntime.php — capture/restore insert around implement (do not always clear)
  • lib/JIT/Context.php — remove LastErrorRuntime::ensureStandaloneBodies from ensureMinimalUserStandaloneBodies(); keep htmlspecialchars / echo / trigger_error / argv / env essentials
  • Full standalone still ensureStandaloneBodies in ensureFullStandaloneBodies

Repro

./script/docker-exec.sh -- bash -lc 'script/cold-build-check.sh'
./script/aot-smoke.sh

Done when

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