Category
php-in-PHP
Problem
lib/AOT/Linker.php still compiles and links lib/JIT/Builtin/hash_crypto_jit_runtime.c (~800 lines of hand-written SHA/MD5 C) on every AOT binary. VM hash builtins already live in ext/hash/ + ext/standard/VmHashNative.php; JIT lowering should reuse that PHP path instead of maintaining a parallel C crypto table.
This blocks M5 self-host honesty (shrink C runtime) and duplicates semantics already tracked in #5989 / #5227.
php-src reference
Behavior reference only — implementation belongs in PHP (ext/hash/, lib/JIT/Builtin/).
Repro (bundle audit)
./script/docker-exec.sh -- bash -lc '
wc -l lib/JIT/Builtin/hash_crypto_jit_runtime.c
grep hash_crypto lib/AOT/Linker.php
php -r "
\$s = file_get_contents(\"lib/AOT/Linker.php\");
echo str_contains(\$s, \"hash_crypto_jit_runtime.c\") ? \"still linked\n\" : \"removed\n\";
"
'
Today: file present (~800 lines) and listed in Linker::RUNTIME_C_SOURCES.
After a minimal hash(\"sha256\", \"x\") AOT fixture, native binary must still print the same digest as Zend without linking hash_crypto_jit_runtime.c.
Scope
| Layer |
Path |
| Delete C |
lib/JIT/Builtin/hash_crypto_jit_runtime.c (after parity) |
| Linker |
lib/AOT/Linker.php — remove from RUNTIME_C_SOURCES |
| JIT/AOT |
ext/standard/JitHash.php, ext/hash/JitHashAlgos.php — route to VmHashNative / existing LLVM helpers |
| VM |
ext/standard/VmHashNative.php, ext/hash/ — SSOT for algorithms |
| Tests |
existing test/compliance/cases/stdlib/hash*.phpt; AOT fixture hash_sha256.phpt |
php-src-strict: enum-case operands must still TypeError (#5780).
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./script/ci-local.sh --filter hash_sha256'
Related
Category
php-in-PHPProblem
lib/AOT/Linker.phpstill compiles and linkslib/JIT/Builtin/hash_crypto_jit_runtime.c(~800 lines of hand-written SHA/MD5 C) on every AOT binary. VM hash builtins already live inext/hash/+ext/standard/VmHashNative.php; JIT lowering should reuse that PHP path instead of maintaining a parallel C crypto table.This blocks M5 self-host honesty (shrink C runtime) and duplicates semantics already tracked in #5989 / #5227.
php-src reference
ext/hash/hash.c— reference algorithmsext/standard/basic_functions.c—hash(),hash_hmac(),md5(),sha1()Behavior reference only — implementation belongs in PHP (
ext/hash/,lib/JIT/Builtin/).Repro (bundle audit)
Today: file present (~800 lines) and listed in
Linker::RUNTIME_C_SOURCES.After a minimal
hash(\"sha256\", \"x\")AOT fixture, native binary must still print the same digest as Zend without linkinghash_crypto_jit_runtime.c.Scope
lib/JIT/Builtin/hash_crypto_jit_runtime.c(after parity)lib/AOT/Linker.php— remove fromRUNTIME_C_SOURCESext/standard/JitHash.php,ext/hash/JitHashAlgos.php— route to VmHashNative / existing LLVM helpersext/standard/VmHashNative.php,ext/hash/— SSOT for algorithmstest/compliance/cases/stdlib/hash*.phpt; AOT fixturehash_sha256.phptphp-src-strict: enum-case operands must still
TypeError(#5780).Done when
hash_crypto_jit_runtime.cremoved from repo or ≤50-line thin ABI stub with proof no algorithm logic remainsLinker::RUNTIME_C_SOURCESno longer references the filehash('sha256', 'x')/md5('x')fixtures match Zend./script/ci-fast.sh --filter Hashgreen; full./script/ci-local.shllvm phases when JIT hash touchedVerification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./script/ci-local.sh --filter hash_sha256'Related