Skip to content

Fix hash crypto JIT link: seal bad-algo block and restore insert BB - #8496

Merged
PurHur merged 1 commit into
masterfrom
agent/fix-string-hash-crypto-unreachable-lane-b
Jun 14, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/fix-string-hash-crypto-unreachable-lane-b

Conversation

@PurHur

@PurHur PurHur commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

Lane B bootstrap fallback — no eligible compile/link issue in lane (# % 3 == 1 without stdlib/php-runtime ownership).

While probing make bootstrap-aot-link, StringHashCryptoNativeJit::emitCompilerHash() hit a fatal on the unknown-algorithm path:

  • PHPLLVM\LLVMAbstract\Builder::unreachable() does not exist — use BasicBlockHelper::sealOpenBlock() instead.

After that, first StringHashCrypto::ensureLinked() during user JIT compile cleared the LLVM insert block; JitHash now saves/restores the insert BB (same pattern as JitErrorLog).

Relates to #7189 / #7437 (hash crypto PHP LLVM lowering).

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/jit.php -r "echo hash(\"md5\", \"x\");"
php bin/jit.php -r "echo hash_hmac(\"sha256\", \"data\", \"key\");"
'
# 9dd4e461268c8034f5c8564e155c67a6
# 5031fe3d989c6d1537a013fa6e739da23463fdaec3b70137d828e36ace221bd0

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/JIT/StringHashCryptoRuntimeStandaloneTest.php
'
# OK (2 tests)

./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-link'
# bootstrap-selfhost-link: OK

Note: Full bootstrap-aot-link (94 targets) still has broader spine/LLVM gaps on master; this PR fixes the hash-crypto implement crash and insert-block loss on the hot hash() / hash_hmac() JIT path.

Made with Cursor

StringHashCryptoNativeJit used builder->unreachable() (missing on PHPLLVM Builder);
use BasicBlockHelper::sealOpenBlock for the unknown-algorithm path. JitHash now saves
and restores the LLVM insert block after ensureLinked, matching JitErrorLog (#7189).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 3cb8bc5 into master Jun 14, 2026
@PurHur
PurHur deleted the agent/fix-string-hash-crypto-unreachable-lane-b branch June 14, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant