Skip to content

php-in-php: delete StringHashCryptoJit NestedJit defer — thin via isThinStandaloneAotMain + real hash_equals (re-#20050) #20065

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, re-#20050 / #19362)

Problem

lib/JIT/Builtin/StringHashCryptoJit.php still gates the thin JitHashCryptoKernel path behind UserScriptAotDeferNestedJit::shouldDefer() (env PHP_COMPILER_AOT_USER_SCRIPT). On that deferred path it also emits hash_equals_deferred_stub that always returns 0 — so user-script AOT hash_equals() is permanently false.

#20050 / StringHashAlgos replaced the NestedJit defer gate with Context::isThinStandaloneAotMain() so bootstrap thin standalone and user-script AOT share one path without the NestedJit audit surface.

php-src reference

PHP implementation target

  • lib/JIT/Builtin/StringHashCryptoJit.php — replace UserScriptAotDeferNestedJit::shouldDefer with $context->isThinStandaloneAotMain(); thin → JitHashCryptoKernel + real StringHashEquals::ensureLinked (delete hash_equals_deferred_stub); embed/non-thin stays StringHashCryptoPhp / JitVmHelperLink
  • test/unit/StringHashCryptoRuntimeShrinkTest.php — assert no UserScriptAotDeferNestedJit; assert isThinStandaloneAotMain; assert no hash_equals_deferred_stub

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/StringHashCryptoRuntimeShrinkTest.php test/unit/StringHashEqualsRuntimeShrinkTest.php
vendor/bin/phpunit --filter HashEqualsBuiltinTest
make bootstrap-selfhost-vm-driver-execute-probe
'

Done when

Refs #1492, #20050, #19362, #10533

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