Skip to content

Stdlib/JIT: ext/posix helpers unsupported — posix_times/posix_setsid/etc need JIT/AOT lowering (ext/posix/posix.c) #9218

Description

@PurHur

Category

stdlib · jit · php-src-strict

Problem

Several ext/posix helpers are implemented for VM but hard-stubbed for JIT/AOT builds. In-tree examples:

This creates surprising VM vs JIT divergence and blocks CLI tooling compiled under bin/jit.php / AOT.

php-src reference

Repro

cat > /tmp/repro_posix_jit.php <<'PHP'
<?php
foreach (['posix_times', 'posix_setsid', 'posix_getrlimit'] as $fn) {
    echo $fn, ' exists=', var_export(function_exists($fn), true), "\n";
    if (function_exists($fn)) {
        try { var_dump($fn()); } catch (Throwable $e) { echo '  ', get_class($e), ': ', $e->getMessage(), "\n"; }
    }
}
PHP
./script/docker-exec.sh -- bash -lc 'php /tmp/repro_posix_jit.php; php bin/vm.php /tmp/repro_posix_jit.php; php bin/jit.php /tmp/repro_posix_jit.php'
Backend posix_times()
Zend PHP array of ticks (or false + warning if unsupported)
bin/vm.php array (platform-dependent)
bin/jit.php (today) fatal Error from JIT stub

Expected (Zend)

Returns structured arrays / ints per stub; warnings + false when the host cannot satisfy the call — never a compile-time stub Error.

Scope (PHP-in-PHP)

Layer Path
Policy decide VM-fallback vs native JIT lowering per function
PHP SSOT reuse ext/posix/VmPosix*.php helpers where they exist
JIT add lowering in ext/posix/JitPosix.php or mark VM-only in capability matrix with explicit runtime fallback
Tests test/compliance/cases/ext/posix_times_jit.phpt (skip when host lacks POSIX)

Prefer PHP implementations + thin FFI; avoid new runtime/*.c tables.

Done when (php-src-strict)

  • php bin/jit.php /tmp/repro_posix_jit.php no longer fatals on supported platforms
  • VM and JIT agree on the repro probes
  • docs/capabilities.md regenerated — JIT column matches reality
  • Unsupported platforms: Zend-aligned warnings/false, not LogicException stubs

Related

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 / JITimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions