Category
php-in-php · JIT shrink · #1492
Problem
Phase 1 (#14842) routes string-builtin array_find family predicates through ArrayFindJitHelper::walkWithBuiltin PHP. Closure/arrow callbacks still lower via ~800-line LLVM loops in lib/JIT/ArrayFindHelper.php (resolvePredicateHandler + hashtable walk).
Migrate closures to ArrayFindJitHelper::walkWithClosure via ArrayFindRuntime + JitVmHelperLink, matching ArrayMapJitHelper / ArrayReduceJitHelper (#14977, #14979).
php-src reference
PHP implementation target
| Path |
Work |
ext/standard/ArrayFindJitHelper.php |
Add walkWithClosure() using VmClosureCall + VmArrayValueCallback::predicateMatches |
lib/JIT/Builtin/ArrayFindRuntime.php |
Closure ABI bridge (__array_find__closure) |
lib/JIT/ArrayFindHelper.php |
Shrink — delegate closure callbacks to ArrayFindRuntime; keep LLVM for user-function proxies until next slice |
Repro / verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter array_find_closure'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter ArrayFindRuntimeShrinkTest'
Done when
Category
php-in-php· JIT shrink · #1492Problem
Phase 1 (#14842) routes string-builtin
array_findfamily predicates throughArrayFindJitHelper::walkWithBuiltinPHP. Closure/arrow callbacks still lower via ~800-line LLVM loops inlib/JIT/ArrayFindHelper.php(resolvePredicateHandler+ hashtable walk).Migrate closures to
ArrayFindJitHelper::walkWithClosureviaArrayFindRuntime+JitVmHelperLink, matchingArrayMapJitHelper/ArrayReduceJitHelper(#14977, #14979).php-src reference
ext/standard/array.c—php_array_find,php_array_find_key,php_array_any,php_array_allPHP implementation target
ext/standard/ArrayFindJitHelper.phpwalkWithClosure()usingVmClosureCall+VmArrayValueCallback::predicateMatcheslib/JIT/Builtin/ArrayFindRuntime.php__array_find__closure)lib/JIT/ArrayFindHelper.phpArrayFindRuntime; keep LLVM for user-function proxies until next sliceRepro / verification
Done when
ArrayFindJitHelperPHP (no closure branch in LLVM walk loops)ArrayFindHelper.phpline count reduced;ArrayFindRuntimeShrinkTestupdatedarray_find_closure_inline.phpt,array_find_key_callback_order.phpt,array_find_strict_jit.phpt