Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101821 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4946 invoked from network); 10 Feb 2018 15:03:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2018 15:03:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=i@lvht.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=i@lvht.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lvht.net from 103.7.28.233 cause and error) X-PHP-List-Original-Sender: i@lvht.net X-Host-Fingerprint: 103.7.28.233 smtpbg65.qq.com Linux 2.5 (sometimes 2.4) (4) Received: from [103.7.28.233] ([103.7.28.233:31546] helo=smtpbg65.qq.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/4A-21403-7B90F7A5 for ; Sat, 10 Feb 2018 10:03:20 -0500 X-QQ-mid: bizesmtp5t1518274990tfpjdp6w9 Received: from [192.168.1.4] (unknown [222.71.123.232]) by esmtp4.qq.com (ESMTP) with id ; Sat, 10 Feb 2018 23:03:09 +0800 (CST) X-QQ-SSF: 0110000000400070F860000A0000000 X-QQ-FEAT: 3GtnPQ8BMmaaZ5Kt0lNq6NdUEzWFqwiX8he7eBAEnSV56rmVrgckuBgmehdk1 0XJ7Ih2dP0pD/zoZhuj5bDTbJsqX/0ABMwy2uLOr7YZluJ/ZHa1BTkwtUb6a00o45CZzEHf PRNdN/p2Gyu/RwVdqscQaRddkFLDGBTCblKikxEPPIKmIkrOqH6KO0QWAVeyrgUf7+SLSOx 9N0CiYdrO7RCeIzkadbBZT+PFsWxQi9McSE2duR64EMMFTMGJZYSnZo69xZRmtvdgxHZczu U7EJGF49R421llLph7kiQrZYg= X-QQ-GoodBg: 0 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.10\)) In-Reply-To: Date: Sat, 10 Feb 2018 23:03:09 +0800 Cc: Aaron Piotrowski , PHP Internals , Dmitry Stogov Content-Transfer-Encoding: quoted-printable Message-ID: <60FDAEC8-02A4-4AAE-A5E3-4A119946BEB5@lvht.net> References: <76EBF900-3BE8-4B60-9422-880A9754FCC4@lvht.net> <0DDFDACA-6322-461C-9D57-215E8C7D9CD0@trowski.com> To: Niklas Keller X-Mailer: Apple Mail (2.3445.6.10) X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:lvht.net:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 Subject: Re: [PHP-DEV] [RFC] Fiber support (again) From: i@lvht.net (=?utf-8?B?5ZCV5rW35rab?=) > On Feb 10, 2018, at 22:49, Niklas Keller wrote: >=20 >> Hi, all, >>=20 >> I have updated the RFC https://wiki.php.net/rfc/fiber >>=20 >> changes list: >>=20 >> - introduce the `throw(Exception $exceptin)` API >> - record issues discussed >=20 > What about my suggestion of making PHP's main() automatically a Fiber, > which avoids Fiber::yield() being used outside of a Fiber, because > everything is a Fiber? >=20 > This would require another continuation mechanism, as nothing has > access to the automatically created main()-Fiber otherwise. >=20 > There would also need to be something that stops the script execution > as soon as there's no non-suspended Fiber anymore. As you pointed out, the main process cannot be a Fiber because it need = to schedule other fibers.=20 >=20 > Regarding the internal calls: A core dump / segfault in case of > Fiber::yield() inside an internal function is unacceptable. It doesn't > give the user any clue what's wrong. Instead, an exception could be > thrown from Fiber::yield(), which just bubbles up then. Full support > for internal functions could be added at a later point then. It is impossible to solve this issue before we get a pure stackless Zend = VM. If this feature can be merged into PHP 7.3, we could introduce a new = counter to record the zend vm nested level. Every time you enter an internal = call, let zend increment the counter, and decrement it when out.=20 When we create a fiber, we remember current vm nested level. When zend = execute Fiber::yield,it will throw an error if the current vm nested level is = not equal to the original one. This feature cannot be implemented without changing the zend vm code = base. Maybe we could get a stackless zend vm in the feature. like the = stackless python https://github.com/stackless-dev/stackless >=20 > Regards, Niklas