Skip to content

php-in-php: route spaceship object/hashtable JIT through CompareJitHelper (#9476) - #11552

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-9476-spaceship-compare-jit-php
Jun 25, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-9476-spaceship-compare-jit-php

Conversation

@PurHur

@PurHur PurHur commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #9476

php-src reference

  • Zend/zend_operators.c — compare_function / spaceship
  • Zend/zend_object_handlers.c — object compare
  • Zend/zend_hash.c — array compare

PHP implementation

  • lib/VM/CompareJitHelper.php — SSOT for scalar + object + hashtable spaceship
  • lib/JIT/Builtin/SpaceshipCompareJit.php — embed bridges (emitObjectCompareSpaceshipBridge, emitHashtableCompareSpaceshipBridge)

Verification

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

php bin/vm.php test/compliance/cases/language/enum_relational_operators.phpt
# bool(false)\nint(1)\nint(1)\nbool(false)\nint(1)

php bin/jit.php test/compliance/cases/language/enum_spaceship.phpt
# int(1)… int(0)… (Zend parity)

php bin/jit.php test/compliance/cases/language/enum_relational_operators.phpt
# bool(false)\nint(1)\nint(1)\nbool(false)\nint(1)

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

Follow-up

Standalone AOT LLVM object/hashtable walkers (~350 lines) can move to SpaceshipCompareStandaloneLlvm.php once nested standalone compile accepts ObjectEntry/HashTable helpers.

Made with Cursor

…lper (#9476)

JIT embed now calls compiled CompareJitHelper::objectSpaceship and
hashtableSpaceship instead of hand-written LLVM walks; standalone AOT
keeps LLVM until nested link supports HashTable/ObjectEntry helpers.

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 SpaceshipCompareJit — route <=> through CompareJitHelper PHP not ~1.2k-line LLVM (#1492)

1 participant