Skip to content

php-in-php: drop Context ensureFullStandaloneBodies always-on StringRandomBytes — lazy at JitRandomBytes/ArrayRand/SessionCreateId (ext/standard/random.c) #35113

Description

@PurHur

Category

php-in-php · runtime-shrink · Pillar Trust (#32122 .1 mint class)

Problem

Context::ensureFullStandaloneBodies still eagerly calls StringRandomBytes::implement($this), NestedJIT-linking __compiler_random_bytes on every full standalone init.

Call sites already ensure before lookup:

Leftover Context NestedJIT vs Runtime ABI drift mints random_bytes.1 (#31894 / #32122). Peer ensureMinimal drop already removed RandomBytes from ensureMinimalUserStandaloneBodies (#34578).

php-src reference

PHP implementation target

  • lib/JIT/Context.php — remove StringRandomBytes::implement($this) from ensureFullStandaloneBodies; document lazy call sites
  • Keep StringRandomBytes::ensureLinked / implement callable from JitRandomBytes / ArrayRand / SessionCreateId
  • No new lib/AOT/runtime/*.c

Repro

./script/aot-smoke.sh
./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/rb.bin -r "echo bin2hex(random_bytes(4));" && /tmp/rb.bin'
./script/phpunit.sh --filter ContextFullStandaloneLazyRandomBytesShrinkTest

Done when

  • ensureFullStandaloneBodies does not call StringRandomBytes::implement / ensureStandaloneBodies
  • AOT random_bytes(4) still produces 8 hex chars (call-site ensureLinked)
  • ./script/aot-smoke.sh stays 8/8
  • Targeted phpunit shrink guard green
  • No new lib/AOT/runtime/*.c

Parent

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions