Reusing main VM stack for generators

From: Date: Fri, 22 Jan 2016 14:43:56 +0000
Subject: Reusing main VM stack for generators
Groups: php.internals 
Request: Send a blank email to internals+get-90834@lists.php.net to get a copy of this message
Hi, Could you please, take a look into the PoC. It's incomplete, but may be you get ideas how to fix this. https://gist.github.com/dstogov/285024375d15cacf2a9b Few tests are failed, because YIELD may be used as expression in nested calls (between INIT_FCALL/DO_FCALL), and the caller function restores EG(vm_stack_top), loosing and overwriting that active frame. <?php function gen() { var_dump(yield 1); } for ($gen = gen(); $gen->valid(); $gen->send(0)) { var_dump($gen->current()); } ?> Thanks. Dmitry.

« previous php.internals (#90834) next »