Skip to content

php-in-php: drop always-on LibcExtern __phpc_resolve_stream after NestedJIT module-local (#32273 shape) #32287

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #32273 malloc / #32092 snprintf / #31885 memcpy)

Problem

Always-on LibcExtern still registers __phpc_resolve_stream on every JIT/AOT module even though:

  1. The body is PHP/LLVM (StreamGlobalsJit standalone / JitStreamLibcHandleKernel embed) — not a libc symbol and not an MCJIT host alias.
  2. NestedJIT stream leaves (JitStreamIoKernel / JitStreamSyncKernel) already declare the same int8*(int64) prototype module-locally, then lookupFunction. Their ensureExternal catch path calls addFunction() without getNamedFunction() — the Fix: AOT link fails for EVERY binary — duplicate memset declaration #31894 / Release v1.1.0: fix cold-build-check compile_failed on hello world (LLVM Module.php line 180; re-#24302) #32122 class (name.1 with no body).
  3. The always-on table comment already says it is the small MCJIT alias set (syscall / __phpc_host_*). __phpc_resolve_stream is leftover.
Path Today Target
Resolve body StreamGlobalsJit / JitStreamLibcHandleKernel unchanged
LibcExtern always-on __phpc_resolve_stream row drop row
NestedJIT consumers rely on always-on + local addFunction LibcExtern::ensureResolveStreamDecl() before lookup
EMBED MCJIT aliases syscall / __phpc_host_* unchanged (#98 / #21109 / #21124)

php-src reference

PHP implementation target

Repro

./script/phpunit.sh --filter 'LibcExternDeadDeclsRuntimeShrinkTest|ResolveStreamRuntimeShrinkTest|StreamGlobalsRuntimeStandaloneTest'

Done when

  • LibcExtern has no always-on '__phpc_resolve_stream' => row
  • NestedJIT lookupFunction('__phpc_resolve_stream') sites call ensureResolveStreamDecl() first
  • Standalone still LLVM-lowers __phpc_resolve_stream with a body (StreamGlobalsRuntimeStandaloneTest)
  • syscall / __phpc_host_php_write / __phpc_host_snprintf remain
  • php-src-strict; user-script fopen()/fwrite() unchanged

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