Skip to content

php-in-php: route JIT hash_equals through HashEqualsJitHelper PHP (#9164) - #10922

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-hash-equals-9164
Jun 23, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-hash-equals-9164

Conversation

@PurHur

@PurHur PurHur commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ext/standard/HashEqualsJitHelper.php delegating to VmHash::equals() (php-src: ext/hash/hash.c)
  • Replace lib/JIT/Builtin/StringHashEquals.php timing-safe compare LLVM loop (~90 lines) with thin JIT bridge
  • LLVM shrink: StringHashEquals.php 125 → 109 lines; removed hash_equals_loop_* / stringData LLVM

Partial progress on #9164 (hash() / hash_hmac() LLVM migration remains open).

php-src reference

  • ext/hash/hash.c — timing-safe compare for hash_equals()
  • PHP SSOT: ext/standard/VmHash.php via HashEqualsJitHelper.php

Verification

vendor/bin/phpunit test/unit/StringHashEqualsRuntimeShrinkTest.php
# OK (3 tests, 9 assertions)

php bin/vm.php -r 'var_export(hash_equals("abc","abc"));'
# true

php bin/jit.php -r 'var_export(hash_equals("abc","abd"));'
# false

make bootstrap-selfhost-vm-driver-execute-probe
# bootstrap-selfhost-vm-driver-execute-probe: OK

Made with Cursor

)

Replace ~90-line timing-safe compare LLVM loop in StringHashEquals with a
thin bridge to VmHash::equals via compiled HashEqualsJitHelper.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 10998ae into master Jun 23, 2026
@PurHur
PurHur deleted the agent/runtime-php-hash-equals-9164 branch June 23, 2026 19:54
PurHur added a commit that referenced this pull request Jun 23, 2026
… JIT helpers (#10924)

Regenerate docs/bootstrap-inventory.md (2949→2951 vm.php-path files) and add
GetcwdJitHelper/GetcwdJit to compiler_lib_spine_smoke so spine coverage stays
complete after recent php-in-php JIT helper splits (#10921, #10922).

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Jun 23, 2026
…10972)

Replace ~2857-line StringHashCryptoNativeJit LLVM monolith with thin
HashCryptoJitHelper → VmHash bridges; hash_equals already migrated in #10922.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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