Skip to content

php-in-php: lazy HashTable locale/natural/multisort LLVM — drop always-on strcoll NestedJIT (ext/standard/array.c) #35904

Description

@PurHur

Category

enhancement · php-in-php / runtime-shrink · Pillar 1 (Trust) · #32122 class

Problem

Type\HashTable::implement() still always emits locale/natural/multisort LLVM (__hashtable__sortStringKeysLocale, __hashtable__sortStringKeyValuesLocale, __hashtable__sort*Natural*, __multisort__packed). Those bodies call ensureStrcollAbis / ensureNaturalCompareAbis, so every AOT compile (including hello-world) NestedJITs strcoll/strnatcmp during HashTable init.

#35626 only moved the ensureLinked call off implement() entry; the sort implement* methods still run at init. Leftover NestedJIT vs Runtime ABI drift mints strcoll.1 / strnatcmp.1 (Module.php:180#31894 / #32122).

Repro Zend 8.2+ AOT today
<?php echo "hi\n"; n/a HashTable init NestedJITs locale/natural/multisort + strcoll

php-src reference

PHP implementation target

  • lib/JIT/Builtin/Type/HashTable.php — do not registerFn/implement* locale/natural/multisort at type init; ensureSortAbi() register+implement on first lookup
  • lib/JIT/Builtin/KeySortRuntime.php / ValueSortRuntime.php / NaturalSortRuntime.php / MultisortRuntime.php — call ensureSortAbi for the ABI in use only
  • No new lib/AOT/runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/hello.bin /tmp/hello.php'

Hello-world IR must not contain __hashtable__sortStringKeysLocale / strcoll from HashTable init.

Done when

  • HashTable::implement() does not call locale/natural/multisort implement*
  • ksort(SORT_LOCALE_STRING) / natsort / array_multisort still work on AOT
  • ./script/aot-smoke.sh stays 8/8
  • No new runtime C

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions