Skip to content

php-in-php: drop always-on LibcExtern/Module stat+access+lstat after JitStatKernel (#30530/#31374 shape) #31403

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #30530 / #31374)

Problem

User-script file_exists / is_* / stat paths already route through StatPathJitHelper + JitStatPathKernel / JitStatKernel (#23297 / #27013). Always-on LibcExtern + Module::jitInit still register libc stat/access/lstat for every compile — same dead always-on surface #31374 removed for chmod/mkdir and #30530 removed for unlink/realpath/….

Path Today Target
User-script AOT path predicates / fields PHP helpers + JitStatKernel (already) unchanged
LibcExtern always-on stat/access/lstat drop rows
Module::jitInit always-on try/add drop; comment #30530/#31374 peer
NestedJIT JitStatKernel lookupFunction relies on always-on module-local ensureLibcStat
TouchLibcRuntime / FtokRuntime / JitFsGlobKernel lookup assumes always-on ensure module-locally (Ftok already has ensureLibcStat)

php-src reference

PHP implementation target

  • lib/JIT/LibcExtern.php — drop stat/access/lstat rows; cite this issue
  • ext/standard/Module.php — drop always-on decls
  • ext/standard/JitStatKernel.php — ensureLibcStat before mode/access/longField
  • lib/JIT/Builtin/TouchLibcRuntime.php / FtokRuntime.php / ext/standard/JitFsGlobKernel.php — ensure before lookup
  • test/unit/LibcExternDeadDeclsRuntimeShrinkTest.php, ModuleAlwaysOnFsDeclsRuntimeShrinkTest.php, StatPathRuntimeShrinkTest.php

Repro / verify

./script/phpunit.sh --filter 'LibcExternDeadDeclsRuntimeShrinkTest|ModuleAlwaysOnFsDeclsRuntimeShrinkTest|StatPathRuntimeShrinkTest|FtokRuntimeShrinkTest|TouchRuntimeShrinkTest'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r "var_export(file_exists(__FILE__));"'

Done when

  • LibcExtern / Module no longer always-declare stat/access/lstat
  • NestedJIT consumers declare module-locally; shrink unit tests green
  • php-src-strict; no php-compiler-strict shortcut
  • Net shrink: always-on libc FS surface reduced (no new C)

Refs #1492, #30530, #31374, #23297, #27013

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