Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90841 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42930 invoked from network); 22 Jan 2016 19:29:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jan 2016 19:29:28 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.76 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.76 blu004-omc2s1.hotmail.com Received: from [65.55.111.76] ([65.55.111.76:53419] helo=BLU004-OMC2S1.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/09-12955-51382A65 for ; Fri, 22 Jan 2016 14:29:26 -0500 Received: from BLU437-SMTP55 ([65.55.111.71]) by BLU004-OMC2S1.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Fri, 22 Jan 2016 11:29:23 -0800 X-TMN: [2j0Fp6zmaexxRk6ebJ2yapd9v5tEAOAJ] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_E7494800-7CB3-4939-8072-CFB043A49E57" MIME-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\)) In-Reply-To: Date: Fri, 22 Jan 2016 20:29:41 +0100 CC: Nikita Popov , PHP internals list References: To: Dmitry Stogov X-Mailer: Apple Mail (2.3096.5) X-OriginalArrivalTime: 22 Jan 2016 19:29:21.0276 (UTC) FILETIME=[318E1BC0:01D1554B] Subject: Re: Reusing main VM stack for generators From: bobwei9@hotmail.com (Bob Weinand) --Apple-Mail=_E7494800-7CB3-4939-8072-CFB043A49E57 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" > Am 22.01.2016 um 15:43 schrieb Dmitry Stogov : >=20 >=20 > Hi, >=20 > Could you please, take a look into the PoC. > It's incomplete, but may be you get ideas how to fix this. >=20 > https://gist.github.com/dstogov/285024375d15cacf2a9b = >=20 > 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. >=20 > function gen() { > var_dump(yield 1); > } >=20 > for ($gen =3D gen(); $gen->valid(); $gen->send(0)) { > var_dump($gen->current()); > } > ?> >=20 > Thanks. Dmitry. Hey, that's pretty similar to what I did = https://github.com/php/php-src/commit/0f0471a9893230918084798d4e35db37d7b4= 519d = in that old patch, which you rejected because we hadn't found any = solution for that issue with yield inside calls. We basically need a way to properly first fetch the args (beware: = func_arg fetches...) before instantiating the call frame, an issue which = for example could be solved if we applied my vm_stack_restructuring = patch (because it only installs call frames after all args were = fetched). I believe this patch won't work without significant refactoring (like = vm_stack_refactoring branch) =E2=80=A6 so, either we bite the bullet and = look at that patch again, or we can forget this idea too. Thanks, Bob= --Apple-Mail=_E7494800-7CB3-4939-8072-CFB043A49E57--