Category
php-in-php | language | runtime
Problem
The spaceship operator (<=>) JIT lowering is lib/JIT/Builtin/SpaceshipCompareJit.php (~1.2k lines LLVM), ported from former lib/AOT/runtime/phpc_spaceship.c. VM semantics SSOT is PHPCompiler\VM\Variable compare/spaceship helpers in PHP.
Enum ordering regressions (#9288) and mixed-type compares must be fixed twice while LLVM tables diverge from VM. PHP-in-PHP first: compile the VM compare path for JIT/AOT instead of maintaining parallel type-switch LLVM.
php-src reference
Zend/zend_operators.c — compare_function, object/enumeration spaceship
Zend/zend_enum.c — backed enum comparison ordering
Repro
<?php
declare(strict_types=1);
enum E: int { case A = 1; case B = 2; }
var_dump(E::A <=> E::B); // Zend: -1 (see #9288 if inverted)
var_dump(null <=> 1); // -1
var_dump('a' <=> 'b'); // -1
Commands
./script/docker-exec.sh php bin/vm.php repro.php
./script/docker-exec.sh php bin/jit.php repro.php
Scope (this repo)
Done when (php-src-strict)
Refs: #1492, #5185, #9288
Category
php-in-php|language|runtimeProblem
The spaceship operator (
<=>) JIT lowering islib/JIT/Builtin/SpaceshipCompareJit.php(~1.2k lines LLVM), ported from formerlib/AOT/runtime/phpc_spaceship.c. VM semantics SSOT isPHPCompiler\VM\Variablecompare/spaceship helpers in PHP.Enum ordering regressions (#9288) and mixed-type compares must be fixed twice while LLVM tables diverge from VM. PHP-in-PHP first: compile the VM compare path for JIT/AOT instead of maintaining parallel type-switch LLVM.
php-src reference
Zend/zend_operators.c—compare_function, object/enumeration spaceshipZend/zend_enum.c— backed enum comparison orderingRepro
Commands
Scope (this repo)
lib/JIT/Builtin/SpaceshipCompareJit.phpandlib/JIT/Builtin/SpaceshipRuntime.phplinker stubsCompareJitHelperorVmVariableCompareextraction underlib/VM/)lib/Compiler.phpspaceship opcode lowering, JIT compare call sitesDone when (php-src-strict)
<=>uses compiled PHP compare helper; enum/object/array cases match VM and Zend on repro + Regression: enum relational operators — < and <=> order inverted vs Zend (re-#9016, zend_enum.c) #9288 guard.SpaceshipCompareJit.php/ any C spaceship symbols.Refs: #1492, #5185, #9288