Skip to content

Language: JIT yield from nested Generator (#4014) - #4032

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-4014-yield-from-nested-gen-jit
Jun 1, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-4014-yield-from-nested-gen-jit

Conversation

@PurHur

@PurHur PurHur commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #4014. Nested yield from inner() generator delegation was already implemented in lib/JIT/GeneratorHelper.php via emitYieldFromGeneratorIter (#3074). This PR:

  • Updates capability matrix notes: JIT supports yield from array and generator delegation; try/catch in generator bodies remains deferred
  • Regenerates docs/capabilities-syntax.md
  • Adds GeneratorJitExecuteTest::testYieldFromGeneratorForeachExecutesViaMcjit (gated by jit-runtime-probe, same as existing generator execute tests)

php-src reference: Zend/zend_generators.c (zend_generator_yield_from)

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit --filter generator_yield_from'
# OK (6 tests, 14 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit test/unit/GeneratorJitCompileTest.php test/compliance/GeneratorJITTest.php'
# OK (7 tests, 31 assertions) — JIT IR lint for yield-from-generator PHPT

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "
function inner() { yield 1; yield 2; }
function outer() { yield from inner(); yield 3; }
foreach (outer() as \$v) echo \$v;
"'
# 123

MCJIT execute via bin/jit.php still segfaults in this LLVM 9 harness for all scripts (pre-existing #98/#2114); GeneratorJITTest / GeneratorJitCompileTest guard IR via compile.php -l.

Made with Cursor

GeneratorHelper already lowers nested `yield from inner()` via
emitYieldFromGeneratorIter (#3074). Update capability matrix notes,
regenerate capabilities-syntax.md, and add a gated MCJIT execute test
matching the issue repro (skipped when jit-runtime-probe fails).

Verification: ./vendor/bin/phpunit --filter generator_yield_from
  ./vendor/bin/phpunit test/unit/GeneratorJitCompileTest.php
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 7ef9950 into master Jun 1, 2026
@PurHur
PurHur deleted the agent/issue-4014-yield-from-nested-gen-jit branch June 1, 2026 17:01
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.

Language: yield from nested Generator — JIT resume/delegate (phase 2 of #3074)

1 participant