Skip to content

php-in-php: opendir/readdir — delete phpc_dir.c + phpc_fs_dir.c, JIT from ext/standard #5258

Closed

Description

@PurHur

Category

php-in-php

Problem

Directory handle builtins (opendir, readdir, closedir, rewinddir) are tracked in #3653, but JIT/AOT still use C state machines in lib/AOT/runtime/phpc_dir.c and lib/AOT/runtime/phpc_fs_dir.c (256-handle tables, scandir(3) backing). This duplicates future PHP/VmFs work and grows the AOT link surface.

php-src reference

Repro

<?php
$h = opendir(__DIR__);
echo readdir($h), "\n";
closedir($h);
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro.php 2>&1 | head -5
php bin/jit.php repro.php 2>&1 | head -5
'

(Expect VM/JIT parity once #3653 lands; this issue removes C after PHP path exists.)

Scope

Layer Path
VM ext/standard/opendir.php, readdir.php, … + VmFs directory listing
JIT Lower via PHP helpers / native VmFs bridge — not phpc_dir_* C
Delete C phpc_dir.c, phpc_fs_dir.c, lib/AOT/Linker.php entries

Done when

  • Both .c files deleted; no directory-handle symbols in AOT runtime
  • JIT/AOT opendir/readdir loop matches Zend ordering (. / .. rules per php-src)
  • ./script/ci-fast.sh --filter opendir green
  • PR notes C lines removed

Related

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 3, 2026
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 / JITarea:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions