Skip to content

php-in-php: array_find family closure JIT via ArrayFindJitHelper PHP (#17547)#17550

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-arrayfind-closure-17547
Jul 9, 2026
Merged

php-in-php: array_find family closure JIT via ArrayFindJitHelper PHP (#17547)#17550
PurHur merged 1 commit into
masterfrom
agent/runtime-php-arrayfind-closure-17547

Conversation

@PurHur

@PurHur PurHur commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 2 of #14842: route closure/arrow array_find family callbacks through nested ArrayFindJitHelper::walkWithClosure PHP instead of LLVM hashtable walk loops in ArrayFindHelper.

C runtime shrink

No new C. LLVM closure walk path bypassed for JIT/AOT; user-function proxies still use ArrayFindHelper LLVM (next slice).

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/unit/ArrayFindRuntimeShrinkTest.php'
# OK (1 test, 6 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_PROFILE=8.4 php bin/jit.php -r "
\$arr = [1, 2, 3];
var_export(array_find(\$arr, fn (\$v) => \$v === 2));
echo \"\n\";
\$a = [1 => \"a\", 2 => \"b\"];
var_export(array_find_key(\$a, fn (\$k, \$v) => \$k === 2));
echo \"\n\";
var_export(array_find(\$arr, fn (\$v) => \$v === 2, true));
"'
# 2
# 2
# 2

Closes #17547

Made with Cursor

…elper PHP (#17547)

Delegate closure/arrow callbacks from ArrayFindHelper LLVM loops to
ArrayFindRuntime + walkWithClosure nested PHP helper (JitVmHelperLink),
matching ArrayMap/ArrayReduce closure paths. Removes dead closure branch
from resolvePredicateHandler.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 4566d27 into master Jul 9, 2026
1 check failed
@PurHur PurHur deleted the agent/runtime-php-arrayfind-closure-17547 branch July 9, 2026 21:10
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 ArrayFindHelper — route closure callbacks through ArrayFindJitHelper PHP not LLVM loops (#1492)

1 participant