Skip to content

php-in-php: hash standalone defer — skip nested hash_algos/hash_equals JIT (#18717)#18770

Merged
PurHur merged 2 commits into
masterfrom
agent/runtime-php-hash-aot-defer
Jul 13, 2026
Merged

php-in-php: hash standalone defer — skip nested hash_algos/hash_equals JIT (#18717)#18770
PurHur merged 2 commits into
masterfrom
agent/runtime-php-hash-aot-defer

Conversation

@PurHur

@PurHur PurHur commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Rebases the #18717 hash standalone defer work onto current master (stale PR #18717 branch had 185-file drift).

  • StringHashCryptoJit: implementDeferred() uses StringHashCryptoLlvm + inline registry + hash_equals stub when UserScriptAotDeferNestedJit — avoids nested HashAlgosJitHelper / HashEqualsJitHelper compile that emits invalid __hashtable__ bridge IR in minimal user-script standalone init.
  • StringHashAlgos: defer path builds __compiler_hash_algos from HashAlgosRegistry::ALL_ALGOS inline LLVM (same pattern as StringHashHmacAlgos).
  • Embed path unchanged: still routes through HashAlgosJitHelper / HashEqualsJitHelper / HashCryptoJitHelper PHP.

php-src ref: ext/hash/hash.c

LLVM / PHP shrink

Verification

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

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "HashModuleTest|hash_context_incremental"'
# OK (12 tests)

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

Note: Full user-script AOT bin/compile.php -r 'echo hash("sha256","hello");' may still hit the separate master __value__writeHashtable module-verify regression documented on #18717 — this PR fixes the hash-specific nested-JIT defer path only.

Closes #18717

Made with Cursor

PurHur and others added 2 commits July 13, 2026 23:10
…ne (#3357)

Use inline HashAlgosRegistry LLVM and stub __compiler_hash_equals during
user-script standalone init instead of nested HashAlgosJitHelper / HashEquals
lowering that emits invalid __hashtable__ bridge IR.

php-src: ext/hash/hash.c
Co-authored-by: Cursor <cursoragent@cursor.com>
…s JIT (#18717)

User-script standalone AOT uses inline HashAlgosRegistry LLVM and a thin
hash_equals stub instead of nested helpers that emit invalid __hashtable__
bridge IR during minimal init. Embed path still routes through
HashAlgosJitHelper / HashEqualsJitHelper PHP.

Verification:
- vendor/bin/phpunit test/unit/StringHashAlgosRuntimeShrinkTest.php
- vendor/bin/phpunit test/unit/StringHashCryptoRuntimeShrinkTest.php
- vendor/bin/phpunit test/unit/JIT/StringHashCryptoRuntimeStandaloneTest.php
- make bootstrap-selfhost-vm-driver-execute-probe

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 774d44d into master Jul 13, 2026
@PurHur PurHur deleted the agent/runtime-php-hash-aot-defer branch July 13, 2026 23:11
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