Skip to content

Stdlib: sort() for packed string and integer arrays (#209)#225

Merged
PurHur merged 1 commit into
masterfrom
feat/stdlib-sort-209
May 18, 2026
Merged

Stdlib: sort() for packed string and integer arrays (#209)#225
PurHur merged 1 commit into
masterfrom
feat/stdlib-sort-209

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 18, 2026

Summary

  • Implements sort() for homogeneous packed list arrays (strings and integers) in the VM, matching the acceptance criteria from Stdlib: usort, uasort, and sort() for array ordering in routers #209.
  • Adds HashTable::replacePackedValues() and LLVM __hashtable__sortPacked for dynamic hashtable arrays in JIT/AOT.
  • Fixed-size native literal arrays (array('b','a','c')) sort in VM only for now; JIT/AOT throws a clear error until native-array codegen is completed.

Test plan

  • php vendor/bin/phpunit test/unit/VM/HashTableSortTest.php
  • php vendor/bin/phpunit test/compliance/VMTest.php (includes sort.phpt)
  • LLVM JIT/AOT with dynamic hashtable routes (follow-up)

Closes #209

Made with Cursor

VM sorts homogeneous list arrays in place for route tables and admin lists.
LLVM __hashtable__sortPacked supports dynamic hashtables in JIT/AOT; fixed
native literal arrays remain VM-only until native codegen is completed.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 250bc81 into master May 18, 2026
@PurHur PurHur deleted the feat/stdlib-sort-209 branch May 18, 2026 18:28
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.

Stdlib: usort, uasort, and sort() for array ordering in routers

1 participant