Skip to content

php-in-php: drop always-on LibcExtern strtod after NestedJIT module-local (#31988 shape) #31997

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #31988 strtol / #31971 strcmp)

Problem

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

  1. User-script floatval() / doubleval() / is_numeric() already live in ext/standard PHP (string-to-float parse uses libc strtod only as a NestedJIT trampoline, not as a user-visible builtin).
  2. ~12 NestedJIT leaves call lookupFunction('strtod') for compile-time numeric parse (scalar cast, filter tokens, min/max, array_unique, typed params, web params) — they rely on the always-on row.
  3. ext/standard/Module.php jitInit still always-declares strtod as a fallback — that path should drop with the LibcExtern row (peer php-in-php: drop always-on LibcExtern strtol after NestedJIT module-local (#31971 shape) #31988 strtol).
Path Today Target
User-script floatval()/is_numeric() ext/standard PHP unchanged
LibcExtern always-on strtod row drop row
NestedJIT consumers rely on always-on LibcExtern::ensureStrtodDecl() before lookup
Module::jitInit always-on strtod fallback drop; comment peer #31988

php-src reference

PHP implementation target

  • lib/JIT/LibcExtern.php — drop 'strtod' always-on row; add ensureStrtodDecl()
  • NestedJIT consumers call LibcExtern::ensureStrtodDecl() before lookupFunction('strtod')
  • ext/standard/Module.php — drop always-on strtod jitInit fallback
  • test/unit/LibcExternDeadDeclsRuntimeShrinkTest.php + StrtodRuntimeShrinkTest — assert row gone + consumer wiring

Repro

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

Done when

  • LibcExtern has no always-on 'strtod' => row
  • All NestedJIT lookupFunction('strtod') sites call ensureStrtodDecl() first
  • LibcExternDeadDeclsRuntimeShrinkTest + shrink guard green
  • php-src-strict; user-script floatval()/is_numeric() behavior 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