Skip to content

php-in-php: drop always-on LibcExtern snprintf after NestedJIT module-local (#32068 shape) #32092

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #32068 strlen / #31706 printf / #31997 strtod)

Problem

Always-on LibcExtern still registers libc snprintf(3) even though:

  1. User-script sprintf() / printf() already live in PHP (JitPrintf / SprintfSnprintfRuntime / ext/standard formatted_print) — not an always-on libc row.
  2. NestedJIT leaves (~38 files) call lookupFunction('snprintf') for compile-time C-string formatting (warnings, number_format, decbin/decoct/dechex, session, OB, Reflection) — they rely on the always-on row.
  3. ensurePrintf() already exists after the printf drop (php-in-php: drop always-on LibcExtern printf after NestedJIT module-local (#31606/#31682 shape) #31706); snprintf is the sibling still in the always-on table. JitNlLanginfo already has a module-local ensureSnprintf that should fold into LibcExtern.
Path Today Target
User-script sprintf()/printf() PHP helpers (JitPrintf / SprintfSnprintfRuntime) unchanged
LibcExtern always-on snprintf row drop row
NestedJIT consumers rely on always-on LibcExtern::ensureSnprintf() before lookup
EMBED MCJIT __phpc_host_snprintf always-on alias unchanged (#98 / #21109 / #21124)

php-src reference

PHP implementation target

Repro

./script/phpunit.sh --filter LibcExternDeadDeclsRuntimeShrinkTest
./script/phpunit.sh --filter SnprintfRuntimeShrinkTest

Done when

  • LibcExtern has no always-on 'snprintf' => row
  • All NestedJIT lookupFunction('snprintf') sites call ensureSnprintf() first (or declare module-locally)
  • LibcExternDeadDeclsRuntimeShrinkTest + shrink guard green
  • php-src-strict; user-script sprintf()/printf() behavior unchanged
  • __phpc_host_snprintf always-on alias remains for EMBED MCJIT

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