Skip to content

php-in-php: chmod() JIT via ChmodJitHelper PHP — drop libc chmod LLVM in JitChmod.php #15458

Description

@PurHur

Category

php-in-php · refs #1492

Problem

ext/standard/JitChmod.php (~70 LOC) lowers JIT chmod() through libc chmod(2) + inline __compiler_trigger_error LLVM. VM SSOT is VmFs::chmod() (pure PHP / VmFsDirPure). JIT should compile the same PHP helper, not duplicate libc.

php-src reference

Repro (architectural)

grep "lookupFunction('chmod')" ext/standard/JitChmod.php

Scope

Path Work
ext/standard/ChmodJitHelper.php invokeArgv() → VmFs::chmod() + TriggerErrorJitHelper warning
lib/JIT/Builtin/StringChmod.php Thin ABI __phpc_jit_chmod bridge
ext/standard/JitChmod.php Thin wrapper like JitRealpath.php
Tests test/unit/ChmodRuntimeShrinkTest.php

Done when

  • No lookupFunction('chmod') in JitChmod.php
  • ChmodJitHelper matches VM on temp file chmod
  • ./script/ci-fast.sh --filter ChmodRuntimeShrink green

Related

#1492

Activity

  1. PurHur commented on Jul 3, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — starting this run.

  2. PurHur commented on Jul 3, 2026

    @PurHur
    OwnerAuthor

    Merged via #15459

    Shrink: ext/standard/JitChmod.php 70 → 22 LOC (−48 lines of libc chmod(2) LLVM + inline __compiler_trigger_error).

    PHP path: ChmodJitHelper → VmFs::chmod() + TriggerErrorJitHelper::warning; StringChmod ABI bridge.

    Verification (Docker):

    • vendor/bin/phpunit test/unit/ChmodRuntimeShrinkTest.php — OK (4 tests)
    • vendor/bin/phpunit --filter "ChmodRuntimeShrink|chmod_jit" — OK (6 tests)
    • make bootstrap-selfhost-vm-driver-execute-probe — OK
    • php script/bootstrap-inventory.php --check — OK 3841/3841
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions