Skip to content

php-in-php: PasswordRandomBytesRuntime NestedJIT → JitVmHelperLink::ensureCompiled (#1492) #22313

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, peer #22300 FtokRuntime / #22256 StringStrcoll)

Problem

lib/JIT/Builtin/PasswordRandomBytesRuntime.php still hand-rolls NestedJitCompileScope::run + parseAndCompile + new JIT() for RandomBytesJitHelper.php. Peer runtimes route helper compile through JitVmHelperLink::ensureCompiled for consistent user-script env clearing, insert-block restore, and helper-runtime cache. StringRandomBytes already uses JitVmHelperLink::ensureBridge for the public random_bytes ABI (#21186); this password-hash nested path should match.

php-src reference

PHP implementation target

  • lib/JIT/Builtin/PasswordRandomBytesRuntime.php — replace ensureJitHelperCompiled body with JitVmHelperLink::ensureCompiled; use lookupCompiled; drop unused use NestedJitCompileScope / use JIT
  • test/unit/PasswordRandomBytesRuntimeShrinkTest.php — guard JitVmHelperLink::ensureCompiled, no hand-rolled NestedJitCompileScope::run / parseAndCompile / new JIT(

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/unit/PasswordRandomBytesRuntimeShrinkTest.php'
make bootstrap-selfhost-vm-driver-execute-probe

Done when

  • PasswordRandomBytesRuntime uses JitVmHelperLink::ensureCompiled only
  • Shrink unit test green
  • make bootstrap-selfhost-vm-driver-execute-probe green
  • PR body cites lines removed

Refs #1492, #9275, #22300, #22256, #21186

Activity

  1. added
    enhancementNew feature or request
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 22, 2026
  2. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — starting this run

    Migrating PasswordRandomBytesRuntime NestedJIT hand-roll to JitVmHelperLink::ensureCompiled (peer FtokRuntime #22300 / StringStrcoll #22256).

    Pre-claim gate snapshot (master @ c9a2793)

    Gate Status
    make bootstrap-selfhost-link in progress (Zend gen-0 fallback after stale native driver #21855)
    php script/bootstrap-inventory.php --check File-list drift (docs regen pending; not a code fail)
    prior peer run user_release_ready: yes on recent master
  3. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    Merged via #22317.

    Verification

    Command Result
    vendor/bin/phpunit test/unit/PasswordRandomBytesRuntimeShrinkTest.php OK (3 tests, 11 assertions)
    vendor/bin/phpunit test/unit/PasswordCryptoRuntimeShrinkTest.php OK (7 tests)
    make bootstrap-selfhost-vm-driver-execute-probe OK
    make north-star5-verify-fast OK (fast)
    php script/bootstrap-inventory.php --check OK 6415/6415
    php script/check-bootstrap-gen0-manifest-sync.php OK (79b4cfef9ecf…)

    NestedJIT shrink

    • lib/JIT/Builtin/PasswordRandomBytesRuntime.php: 129 → 104 lines — deleted hand-rolled NestedJitCompileScope::run + parseAndCompile + new JIT(); now JitVmHelperLink::ensureCompiled
    • Inventory warnings for PasswordRandomBytesRuntime: 3 → 1
  4. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    Merged via #22317.

    Verification

    Command Result
    vendor/bin/phpunit test/unit/PasswordRandomBytesRuntimeShrinkTest.php OK (3 tests, 11 assertions)
    vendor/bin/phpunit test/unit/PasswordCryptoRuntimeShrinkTest.php OK (7 tests)
    make bootstrap-selfhost-vm-driver-execute-probe OK
    make north-star5-verify-fast OK (fast)
    php script/bootstrap-inventory.php --check OK 6415/6415
    php script/check-bootstrap-gen0-manifest-sync.php OK

    NestedJIT shrink

    • lib/JIT/Builtin/PasswordRandomBytesRuntime.php: 129 → 104 lines — deleted hand-rolled NestedJitCompileScope::run + parseAndCompile + new JIT(); now JitVmHelperLink::ensureCompiled
    • Inventory warnings for PasswordRandomBytesRuntime: 3 → 1
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