Skip to content

php-in-php: drop Context ensureFullStandaloneBodies always-on StringFormat — lazy at JitSprintf/Printf/NumberFormat (ext/standard/formatted_print.c) #35130

Description

@PurHur

Category

bug · php-in-php · Trust / #32122 .1 mint class · ensureFullStandaloneBodies shrink

Problem

Context::ensureFullStandaloneBodies still NestedJITs StringFormat (__compiler_sprintf / __compiler_printf / __compiler_number_format) during full standalone init. Thin hello-world and scripts that never call sprintf()/printf()/number_format() pay that NestedJIT — leftover Context NestedJIT vs Runtime ABI drift mints sprintf.1 / printf.1 / number_format.1 (#31894 / #32122).

Call sites already implementIfDeclared / ensureLinked before lookup:

  • ext/standard/JitSprintf.php, JitPrintf.php, JitNumberFormat.php, JitFprintf.php, JitVfprintf.php, JitVsprintf.php
  • vprintf_.php / vfprintf_.php
  • lib/JIT/Builtin/PregMatchRuntime.php, StringOpendir.php

Peer ensureFull drops: #35127 Getenv, #35113 RandomBytes, #35099 ExceptionBridge, #35089 Utf8/Define/…, #35086 Stream*, #35065 Json/Offset, #35073 Assert/Gc.

php-src reference

PHP implementation target

  • lib/JIT/Context.php — remove StringFormat::ensureStandaloneBodies from ensureFullStandaloneBodies
  • Document lazy-full on StringFormat.php
  • Guard test peer #35127 shape; update peer shrink tests that still assert Format stays
  • No new runtime/*.c

Repro / verify

./script/aot-smoke.sh
./script/phpunit.sh --filter 'ContextFullStandaloneLazyStringFormatShrinkTest|ContextFullStandaloneLazyGetenvShrinkTest|TypeDeadFormatAbiRuntimeShrinkTest|StringFormatRuntimeStandaloneTest'
./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/hw.bin -r "echo \"hi\";" && /tmp/hw.bin'
./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/sf.bin -r "echo sprintf(\"%s\", \"ok\");" && /tmp/sf.bin'

Done when

  • ensureFullStandaloneBodies does not NestedJIT StringFormat
  • ./script/aot-smoke.sh stays 8/8
  • Targeted phpunit filter green
  • Hello-world AOT still prints hi; sprintf("%s","ok") AOT prints ok

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 / JITbugSomething isn't workingimplementation-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