Skip to content

php-in-php: drop always-on LibcExtern strchr+strstr after NestedJIT module-local decls (#31458 shape) #31519

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #31458 / #31498 / #31403)

Problem

User-script strchr()/strstr() already route through PHP (VmString::strstr / StrstrJitHelper) — PHP strchr is an alias of strstr, not libc. Always-on LibcExtern still registers libc strchr and dead libc strstr for every compile.

Path Today Target
User-script AOT strchr()/strstr() VmString::strstr / helpers (already) unchanged
LibcExtern always-on strchr + strstr drop both rows
NestedJIT putenv leaf (StringGetenv) lookupFunction('strchr') via always-on ensureLibcStrchr module-local
NestedJIT JitParseStrUserScriptCstrKernel already declares strchr in ensureLibc unchanged
libc strstr no lookupFunction consumers delete dead always-on

php-src reference

PHP implementation target

  • lib/JIT/LibcExtern.php — drop strchr + strstr rows; cite this issue
  • lib/JIT/Builtin/StringGetenv.php — ensureLibcStrchr before NestedJIT putenv strchr lookup
  • ext/standard/JitParseStrUserScriptCstrKernel.php — keep existing module-local strchr in ensureLibc
  • test/unit/LibcExternDeadDeclsRuntimeShrinkTest.php — guard the drop

Repro

./script/phpunit.sh --filter LibcExternDeadDeclsRuntimeShrinkTest
./script/phpunit.sh --filter 'StringGetenv|ParseStr|Strstr'

Done when

  • strchr and strstr absent from LibcExtern specs
  • StringGetenv::invokePutenvNestedLeaf declares strchr module-locally
  • Shrink unit tests green; putenv NestedJIT path still links
  • PR body cites LOC removed from always-on surface

Refs #1492, #31458, #31498, #31403

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