diff --git a/lib/JIT/Builtin/StringNaturalCompareJit.php b/lib/JIT/Builtin/StringNaturalCompareJit.php index 8e8ca1ffa9b..f4425e307ca 100644 --- a/lib/JIT/Builtin/StringNaturalCompareJit.php +++ b/lib/JIT/Builtin/StringNaturalCompareJit.php @@ -5,7 +5,6 @@ namespace PHPCompiler\JIT\Builtin; use PHPCompiler\JIT\BasicBlockHelper; -use PHPCompiler\JIT\Builtin; use PHPCompiler\JIT\Context; use PHPLLVM\BasicBlock; use PHPLLVM\Builder; @@ -13,7 +12,9 @@ use PHPLLVM\Value\Function_ as LlvmFunction; /** - * LLVM natural-order string compare (mirrors VmString::strnatcmp / strnatcasecmp, phpc_strnatcmp.c). + * LLVM natural-order string compare (mirrors VmString::strnatcmp / strnatcasecmp). + * + * Replaces deleted lib/AOT/runtime/phpc_strnatcmp.c + phpc_strnatcasecmp.c (#5517). */ final class StringNaturalCompareJit { @@ -29,12 +30,6 @@ public static function implementStrnatcasecmp(Context $context): void private static function implementNamed(Context $context, string $name, bool $caseInsensitive): void { - if (Builtin::LOAD_TYPE_STANDALONE === $context->loadType) { - self::declareIfMissing($context, $name); - - return; - } - $probe = $context->module->getNamedFunction($name); if (null !== $probe && $probe->countBasicBlocks() > 0) { $context->registerFunction($name, $probe); diff --git a/test/compliance/StrnatcmpJITTest.php b/test/compliance/StrnatcmpJITTest.php new file mode 100644 index 00000000000..c50f8cf2390 --- /dev/null +++ b/test/compliance/StrnatcmpJITTest.php @@ -0,0 +1,29 @@ + self::parsePHPT( + __DIR__.'/cases/stdlib/strnatcmp_jit.phpt', + 'strnatcmp_jit.phpt' + ); + } + + public function setUp(): void + { + $this->BIN = realpath(__DIR__.'/../../bin/jit.php'); + } +} diff --git a/test/compliance/cases/stdlib/strnatcmp_jit.phpt b/test/compliance/cases/stdlib/strnatcmp_jit.phpt new file mode 100644 index 00000000000..10cceb8335c --- /dev/null +++ b/test/compliance/cases/stdlib/strnatcmp_jit.phpt @@ -0,0 +1,14 @@ +--TEST-- +JIT: strnatcmp() / strnatcasecmp() (#5517) +--FILE-- +lookupFunction($name); + $this->assertNotNull($fn); + $this->assertGreaterThan(0, $fn->countBasicBlocks()); + } + } +}