Category
php-in-php · runtime-shrink (#1492 , peer #32092 snprintf / #31706 printf)
Problem
Always-on Builtin\Output still registers libc sprintf(3) (Output.pre declare { function sprintf(char*, const char*, ...): int32; }) even though:
User-script sprintf() already lives in PHP (JitPrintf / SprintfSnprintfRuntime / __compiler_sprintf) — not this always-on libc row.
NestedJIT has only two lookupFunction('sprintf') consumers: HashTableWriteLlvm::objectPointerAsStringKey (bounded 32-byte SplObjectStorage key buffer) and ext/filter/JitFilter::jitScalarToString (native long/double → string). Both should use module-local snprintf like the php-in-php: drop always-on LibcExtern snprintf after NestedJIT module-local (#32068 shape) #32092 leaves.
LibcExtern already dropped always-on snprintf (php-in-php: drop always-on LibcExtern snprintf after NestedJIT module-local (#32068 shape) #32092 ); this leftover sprintf row in Output is the sibling still declared on every module.
Path
Today
Target
User-script sprintf()/printf()
PHP helpers (JitPrintf / SprintfSnprintfRuntime)
unchanged
Builtin\Output
always-on libc sprintf
drop declare
NestedJIT consumers
rely on always-on sprintf
LibcExtern::ensureSnprintf() + snprintf
EMBED MCJIT
__phpc_host_snprintf always-on alias
unchanged (#98 / #21109 / #21124 )
php-src reference
PHP implementation target
lib/JIT/Builtin/Output.pre / Output.php — drop always-on libc sprintf declare
lib/JIT/HashTableWriteLlvm.php — objectPointerAsStringKey uses ensureSnprintf() + snprintf (drop sprintf/strlen)
ext/filter/JitFilter.php — jitScalarToString long/double uses ensureSnprintf() + __string__init
test/unit/SprintfRuntimeShrinkTest.php — assert Output no longer addFunction('sprintf'); consumers call ensureSnprintf
Repro
./script/phpunit.sh --filter ' SprintfRuntimeShrinkTest|LibcExternDeadDeclsRuntimeShrinkTest|SnprintfRuntimeShrinkTest'
Done when
Category
php-in-php· runtime-shrink (#1492, peer #32092 snprintf / #31706 printf)Problem
Always-on
Builtin\Outputstill registers libcsprintf(3)(Output.predeclare { function sprintf(char*, const char*, ...): int32; }) even though:sprintf()already lives in PHP (JitPrintf/SprintfSnprintfRuntime/__compiler_sprintf) — not this always-on libc row.lookupFunction('sprintf')consumers:HashTableWriteLlvm::objectPointerAsStringKey(bounded 32-byte SplObjectStorage key buffer) andext/filter/JitFilter::jitScalarToString(native long/double → string). Both should use module-localsnprintflike the php-in-php: drop always-on LibcExtern snprintf after NestedJIT module-local (#32068 shape) #32092 leaves.LibcExternalready dropped always-onsnprintf(php-in-php: drop always-on LibcExtern snprintf after NestedJIT module-local (#32068 shape) #32092); this leftoversprintfrow inOutputis the sibling still declared on every module.JitPrintf/SprintfSnprintfRuntime)Builtin\OutputsprintfsprintfLibcExtern::ensureSnprintf()+snprintf__phpc_host_snprintfalways-on aliasphp-src reference
ext/standard/formatted_print.c—PHP_FUNCTION(sprintf)/printfext/filter/filter.c—php_filter_stringscalar string conversionext/spl/spl_observer.cPHP implementation target
lib/JIT/Builtin/Output.pre/Output.php— drop always-on libcsprintfdeclarelib/JIT/HashTableWriteLlvm.php—objectPointerAsStringKeyusesensureSnprintf()+snprintf(dropsprintf/strlen)ext/filter/JitFilter.php—jitScalarToStringlong/double usesensureSnprintf()+__string__inittest/unit/SprintfRuntimeShrinkTest.php— assert Output no longeraddFunction('sprintf'); consumers callensureSnprintfRepro
./script/phpunit.sh --filter 'SprintfRuntimeShrinkTest|LibcExternDeadDeclsRuntimeShrinkTest|SnprintfRuntimeShrinkTest'Done when
Builtin\Outputhas no always-on libcsprintfdeclarelookupFunction('sprintf')remainssnprintfsprintf()behavior unchanged__phpc_host_snprintfalways-on alias remains for EMBED MCJIT