Repository navigation
php-in-php: hash_crypto_jit_runtime.c (~800 lines) — delete after VmHashNative JIT/AOT link (#5989 phase 2) #7189
Description
Activity
- addedenhancementNew feature or requestNew feature or requestphase-0:FoundationPhase 0 – foundation & DevExPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsarea:compilerCompiler / CFG / JITCompiler / CFG / JITarea:vmVirtual machineVirtual machineimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claim
on Jun 7, 2026 claim: PHP Runtime → PHP — starting this run (#7189: replace hash_crypto_jit_runtime.c with PHP LLVM lowering from VmHashNative, delete ~800 lines C).
Handoff: full deletion of hash_crypto_jit_runtime.c requires porting sha256/sha1/md5/HMAC/PBKDF2 digest loops from VmHashNative into PHP LLVM emission (~800 lines IR). Scope matches #7078 json_decode migration. Next run should add HashCryptoNativeJit.php mirroring VmHashNative + StringGetrusage pattern, then drop C from Linker + StringHashCryptoJit bitcode path.
claim: PHP Runtime → PHP — starting this run (#7189: StringHashCryptoNativeJit LLVM from VmHashNative, delete hash_crypto_jit_runtime.c ~800 lines).
Phase 1 merged via #7480.
C shrink: 38 lines removed from `hash_crypto_jit_runtime.c` (`__compiler_hash_equals`, `__compiler_hash_hmac_algos` deleted).
PHP LLVM: `lib/JIT/Builtin/StringHashEquals.php`, `StringHashHmacAlgos.php` — wired from `StringHashCryptoJit::implement()` before MCJIT bitcode link.
Verification (green): JIT compliance `hash_equals` / `hash_hmac_algos` / `hash_hmac`; JIT repro `hash_equals('abc','abc')` → true, `count(hash_hmac_algos())` → 3, `hash('sha256','x')` unchanged.
Phase 2 handoff: port remaining digest/PBKDF2 (~762 C lines) to PHPLLVM Builder from `VmHashNative.php`, then delete `hash_crypto_jit_runtime.c` from Linker entirely.
- added a commit that references this issue
on Jun 7, 2026 claim: PHP Runtime → PHP — starting this run (#7189 phase 2 complete: verify StringHashCryptoNativeJit standalone LLVM + close issue).
- added a commit that references this issue
on Jun 9, 2026 Merged via #7754.
C shrink:
hash_crypto_jit_runtime.c+hash_crypto.cdeleted (~800 lines total, phase 1 in #7480/#7437; phase 2 completed here).PHP LLVM:
StringHashCryptoNativeJitnow emits all helper symbols (__phpc_hc_digest_len,__phpc_hc_hex_encode,__phpc_hc_result_string+ digest transforms).StringHashEqualsCFG/allocation fix removes standalone segfault.Verification (green):
vendor/bin/phpunit --filter StringHashCryptoRuntimeStandaloneTest -c phpunit.xml.dist # OK 2/2 php bin/jit.php -r "echo hash_hmac('sha256','body','key'), PHP_EOL;" # 515aae133b... php bin/jit.php -r "echo hash_equals('abc','abc') ? 'eq' : 'no';" # eq
Category
php-in-php|runtimeProblem
JIT/AOT still compile and link
lib/JIT/Builtin/hash_crypto_jit_runtime.c(~800 lines) forhash()/hash_hmac()/hash_file()native lowering, duplicating digest logic that already lives in PHP (ext/hash/,ext/standard/VmHashNative.php).#5989 tracks deleting
hash_crypto.c(~779 lines) from AOT runtime; this issue is the companion JIT bitcode object wired vialib/JIT/Builtin/StringHashCryptoJit.phpandlib/AOT/Linker.php.Workers should not extend this C file — port algorithms to PHP and shrink link surface.
php-src reference
ext/hash/hash.c— reference digest dispatchext/standard/basic_functions.c—md5()/sha1()wrappersRepro (failure today — C still linked)
hash_crypto_jit_runtime.cline countLinker.php)ext/standard/VmHashNative.php,ext/hash/*handlers exist on VMScope (this repo)
lib/JIT/Builtin/StringHashCryptoJit.php,lib/JIT/Builtin/JitHash.phplib/AOT/Linker.phphash_crypto_jit_runtime.cfrom$runtimeSourceswhen symbols satisfiedlib/JIT/Builtin/hash_crypto_jit_runtime.cStringHashCryptoRuntimeStandaloneTest, compliancehash*.phptscript/capability-matrix.phpPHP-in-PHP first: digest tables and update loops belong in
ext/hash/+ JIT lowerers; C allowed only as thin extern until deletion proof is green.Pairs: #5989, #5227, #7174 (HashContext incremental API).
Done when
lib/JIT/Builtin/hash_crypto_jit_runtime.cdeleted (or ≤40-line frozen ABI stub likephpc_progress.c)./script/ci-local.sh --filter hashand--filter StringHashCryptogreen on VM and JIT/AOTruntime/*.cin the same PRVerification
Links