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:
User-script sprintf() / printf() already live in PHP (JitPrintf / SprintfSnprintfRuntime / ext/standard formatted_print) — not an always-on libc row.
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.
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
Category
php-in-php· runtime-shrink (#1492, peer #32068 strlen / #31706 printf / #31997 strtod)Problem
Always-on
LibcExternstill registers libcsnprintf(3)even though:sprintf()/printf()already live in PHP (JitPrintf/SprintfSnprintfRuntime/ext/standardformatted_print) — not an always-on libc row.lookupFunction('snprintf')for compile-time C-string formatting (warnings, number_format, decbin/decoct/dechex, session, OB, Reflection) — they rely on the always-on row.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.JitNlLanginfoalready has a module-localensureSnprintfthat should fold intoLibcExtern.JitPrintf/SprintfSnprintfRuntime)LibcExternsnprintfrowLibcExtern::ensureSnprintf()before lookup__phpc_host_snprintfalways-on aliasphp-src reference
ext/standard/formatted_print.c—PHP_FUNCTION(sprintf)/printfext/standard/math.c—number_format/decoct/dechex/decbinstring conversionPHP implementation target
lib/JIT/LibcExtern.php— drop'snprintf'always-on row; addensureSnprintf()(peerensurePrintfphp-in-php: drop always-on LibcExtern printf after NestedJIT module-local (#31606/#31682 shape) #31706)LibcExtern::ensureSnprintf()beforelookupFunction('snprintf')ext/standard/JitNlLanginfo.php— fold localensureSnprintfintoLibcExtern::ensureSnprintftest/unit/LibcExternDeadDeclsRuntimeShrinkTest.php+ shrink guard — assert row gone + consumer wiringRepro
Done when
LibcExternhas no always-on'snprintf' =>rowlookupFunction('snprintf')sites callensureSnprintf()first (or declare module-locally)LibcExternDeadDeclsRuntimeShrinkTest+ shrink guard green__phpc_host_snprintfalways-on alias remains for EMBED MCJIT