Category
php-in-php · php-src-strict
Problem
hash(), hash_hmac(), hash_pbkdf2(), and related builtins have VM implementations in ext/standard/VmHash.php, but JIT/AOT link StringHashCryptoJit which lowers to native __compiler_hash_* LLVM helpers (OpenSSL/libcrypto paths in lib/JIT/Builtin/StringHashCrypto.php / StringHashCryptoJit.php).
This duplicates crypto semantics in C/LLVM, blocks M5 self-host shrink (#1492), and risks algorithm/encoding drift vs VM.
php-src reference
Repro
<?php
echo hash('sha256', 'abc'), "\n";
echo hash_hmac('sha256', 'data', 'key'), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro.php
php bin/jit.php repro.php
# Compare; JIT today uses __compiler_hash_* not VmHash PHP
'
Scope (this repo)
| Layer |
Work |
| JIT |
Route StringHashCrypto / StringHashCryptoJit through compiled VmHash helpers (mirror StringFormatJit → VmSprintf pattern) |
| AOT |
Same |
| C shrink |
Remove unused __compiler_hash_* LLVM emitters when PHP path covers all algorithms in matrix |
| Tests |
JIT rows on existing test/compliance/cases/stdlib/hash*.phpt |
Done when
Ref: #1492 · #7189
Category
php-in-php· php-src-strictProblem
hash(),hash_hmac(),hash_pbkdf2(), and related builtins have VM implementations inext/standard/VmHash.php, but JIT/AOT linkStringHashCryptoJitwhich lowers to native__compiler_hash_*LLVM helpers (OpenSSL/libcrypto paths inlib/JIT/Builtin/StringHashCrypto.php/StringHashCryptoJit.php).This duplicates crypto semantics in C/LLVM, blocks M5 self-host shrink (#1492), and risks algorithm/encoding drift vs VM.
php-src reference
ext/standard/hash.c—PHP_FUNCTION(hash),hash_hmacext/standard/hash_hmac.cext/standard/VmHash.php,ext/standard/hash.php,hash_hmac.phpRepro
Scope (this repo)
StringHashCrypto/StringHashCryptoJitthrough compiledVmHashhelpers (mirrorStringFormatJit→VmSprintfpattern)__compiler_hash_*LLVM emitters when PHP path covers all algorithms in matrixtest/compliance/cases/stdlib/hash*.phptDone when
hash()/hash_hmac()match VM on compliance PHPTs (incl. invalid algoValueError)hash_equals()/hash_hmac_algos()(may share helper module)Ref: #1492 · #7189