Skip to content

php-in-php: route JIT random_bytes through RandomBytesJitHelper PHP (#9149) - #10921

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-random-bytes-9149
Jun 23, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-random-bytes-9149

Conversation

@PurHur

@PurHur PurHur commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ext/standard/RandomBytesJitHelper.php delegating to VmRandomPure::randomBytes() (php-src: ext/standard/random.c)
  • Replace lib/JIT/Builtin/StringRandomBytes.php /dev/urandom open/read LLVM (~140 lines) with thin JIT bridge calling compiled PHP helper
  • LLVM shrink: StringRandomBytes.php 140 → 103 lines; removed all open/read/close LLVM

Closes #9149

php-src reference

  • ext/standard/random.c — php_random_bytes()
  • PHP SSOT: ext/standard/VmRandomPure.php via RandomBytesJitHelper.php

Verification

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

php bin/vm.php -r '$b=random_bytes(16); echo strlen($b),"\n";'
# 16

php bin/jit.php -r '$b=random_bytes(16); echo strlen($b),"\n";'
# 16

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

php script/check-selfhost-spine-coverage-sync.php
# OK

Made with Cursor

…9149)

Replace ~140-line /dev/urandom open/read LLVM in StringRandomBytes with a thin
bridge to VmRandomPure via compiled RandomBytesJitHelper.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit b209ebb into master Jun 23, 2026
@PurHur
PurHur deleted the agent/runtime-php-random-bytes-9149 branch June 23, 2026 19:51
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>
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.

php-in-php: JIT StringRandomBytes — route random_bytes() through VmRandom PHP not /dev/urandom LLVM (#1492)

1 participant