Skip to content

php-in-php: hash() JIT/AOT — delete hash_crypto.c after native VmHash (pairs with #4790) #5227

Description

@PurHur

Category

php-in-php · bootstrap

Problem

hash() / hash_hmac() VM builtins delegate to host \hash() / \hash_hmac() in ext/standard/VmHash.php (issue #179). Separately, AOT/JIT still link lib/AOT/runtime/hash_crypto.c for native digest symbols. Self-host (#4790) needs pure-PHP (or compiled-PHP) digests; once VmHash is native, hash_crypto.c must be deleted — not extended with new algorithms.

php-src reference

Repro (dual path today)

grep hash_crypto lib/AOT/Linker.php
head -25 ext/standard/VmHash.php   # host \\hash() delegation
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "echo hash(\"sha256\",\"x\");"'
Layer Today
VM Host \hash() via VmHash.php
AOT link hash_crypto.c compiled into binary

Scope (this repo)

Area Files
VM ext/standard/VmHash.php — native sha256/sha1/md5 (coordinate #4790)
Delete C lib/AOT/runtime/hash_crypto.c, lib/AOT/Linker.php entry
JIT any lib/JIT/Builtin/*Hash* handlers — PHP lowering only
Tests existing hash PHPTs + bootstrap inventory

Done when

  • hash('sha256', $data) works on VM without host hash extension
  • hash_crypto.c removed; AOT link succeeds
  • ./script/ci-local.sh --filter hash green (or targeted hash tests)
  • PR cites php-src reference + lists C symbols removed

Dependencies

Links

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