Category
php-in-php · language · compile-pipeline migration (#1492)
Problem
<=> (spaceship) lowering for JIT/AOT lives in lib/JIT/Builtin/SpaceshipCompareJit.php (~1,190 lines of LLVM type dispatch, hashtable walks, object compares). Scalar semantics already have a PHP SSOT in lib/VM/CompareJitHelper.php via SpaceshipRuntime, but object/hashtable paths remain duplicated in LLVM.
This blocks shrinking the JIT emit surface and keeps compare edge cases (enum objects, NAN, arrays) divergent from VM — see #9288 (enum <=> order regression).
php-src reference
Repro (behavior anchor — enum order)
test/repro/enum_relational.php:
<?php
enum E: int { case A = 1; case B = 2; }
var_export(E::A <=> E::B);
./script/docker-exec.sh -- php bin/vm.php test/repro/enum_relational.php # today: -1 (wrong)
./script/docker-exec.sh -- php test/repro/enum_relational.php # Zend: 1
Migration done-when is JIT calls PHP helper; enum ordering fix may land here or via #9288 — both must be green before close.
Scope (this repo)
| Layer |
Path |
| LLVM today |
lib/JIT/Builtin/SpaceshipCompareJit.php, lib/JIT/Builtin/SpaceshipRuntime.php |
| PHP SSOT |
lib/VM/CompareJitHelper.php, shared with VM <=> |
| Delete/shrink |
Remove scalar/object compare LLVM once MCJIT/AOT route through PHP trampoline |
| Tests |
Existing spaceship compliance + enum_relational.php guard |
Done when
Related
Category
php-in-php·language· compile-pipeline migration (#1492)Problem
<=>(spaceship) lowering for JIT/AOT lives inlib/JIT/Builtin/SpaceshipCompareJit.php(~1,190 lines of LLVM type dispatch, hashtable walks, object compares). Scalar semantics already have a PHP SSOT inlib/VM/CompareJitHelper.phpviaSpaceshipRuntime, but object/hashtable paths remain duplicated in LLVM.This blocks shrinking the JIT emit surface and keeps compare edge cases (enum objects, NAN, arrays) divergent from VM — see #9288 (enum
<=>order regression).php-src reference
Zend/zend_operators.c—compare_function/ spaceshipZend/zend_enum.c— enum compare rulesRepro (behavior anchor — enum order)
test/repro/enum_relational.php:Migration done-when is JIT calls PHP helper; enum ordering fix may land here or via #9288 — both must be green before close.
Scope (this repo)
lib/JIT/Builtin/SpaceshipCompareJit.php,lib/JIT/Builtin/SpaceshipRuntime.phplib/VM/CompareJitHelper.php, shared with VM<=>enum_relational.phpguardDone when
<=>on scalars/enums/arrays/objects callsCompareJitHelper(or thin LLVM trampoline only)SpaceshipCompareJit.phpreduced to link stubs or deleted; no duplicated compare tables in LLVM./script/ci-fast.sh --filter Spaceshipgreen; enum relational repro matches ZendSpaceshipCompareJit.php(target: majority of ~1.2k LLVM)Related