Skip to content

php-in-php: drop Context ensureMinimalUserStandaloneBodies always-on StringHtmlspecialchars — lazy at call sites #34642

Description

@PurHur

Category

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

Problem

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

  • StringHtmlspecialchars::ensureStandaloneBodies → NestedJIT / bridge (HtmlspecialcharsJitHelper)

Same always-on NestedJIT vs Runtime ABI drift / cold-build surface class as closed #34631 / #34621 / #34612 / #34605 and open peer #34641 (StringTriggerError). Leftover Context NestedJIT vs Runtime ABI drift mints *.1 (#31894 / #32122).

Call site already StringHtmlspecialchars::ensureLinked before lookup (ext/standard/htmlspecialchars.php). Peer #34612 already lazy-dropped HtmlEntities / HtmlspecialcharsDecode for the same reason.

Repro Zend 8.2+ AOT thin hello-world
echo "hi"; (no htmlspecialchars) hi must not NestedJIT htmlspecialchars ABI during init
echo htmlspecialchars('<'); &lt; matches Zend via call-site ensureLinked

php-src reference

PHP implementation target

  • lib/JIT/Context.php ensureMinimalUserStandaloneBodies — remove StringHtmlspecialchars::ensureStandaloneBodies
  • Keep call-site ensureLinked in ext/standard/htmlspecialchars.php
  • Update peer shrink keep-lists + ExamplesHelloWorldAotRegressionTest / HtmlspecialcharsDecodeRuntimeShrinkTest
  • Unit shrink test + ./script/aot-smoke.sh 8/8

Repro

./script/aot-smoke.sh
./script/docker-exec.sh -- bash -lc 'echo '\''<?php echo htmlspecialchars("<x>");'\'' > /tmp/hs.php && php bin/compile.php -o /tmp/hs.bin /tmp/hs.php && /tmp/hs.bin'

Done when

  • ensureMinimalUserStandaloneBodies does not call StringHtmlspecialchars::ensureStandaloneBodies
  • AOT htmlspecialchars('<') still matches Zend
  • ./script/aot-smoke.sh still 8/8
  • Shrink unit test + peer keep-list updates

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