Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101064 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4785 invoked from network); 5 Nov 2017 13:04:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2017 13:04:29 -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 54.204.34.130 cause and error) X-PHP-List-Original-Sender: i@lvht.net X-Host-Fingerprint: 54.204.34.130 smtpbguseast2.qq.com Received: from [54.204.34.130] ([54.204.34.130:39076] helo=smtpbguseast2.qq.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/86-09857-35C0FF95 for ; Sun, 05 Nov 2017 08:04:21 -0500 X-QQ-mid: bizesmtp3t1509887052tlfv8f3ki Received: from [192.168.1.9] (unknown [218.81.237.25]) by esmtp4.qq.com (ESMTP) with id ; Sun, 05 Nov 2017 21:04:11 +0800 (CST) X-QQ-SSF: 0110000000200050F660B00A0000000 X-QQ-FEAT: nSUdqPGu3tugNija251sZCFc6jRW9RuPp2ihhR3uRkdVKshHnLdNpnR9lOh+L 1YYVnOE95fzhsruzwVTDnXFKlFpPWHW5NmB50HVJdlIScc9fDR7bgBfAwXYk5gJKAi6riOL 0WvkhBspfSeCNNsIiFpB1P+O7VqqG5vwm29kKCfEXWCT4o5nPz9F/IRxJ4pFaY/z0PtffPR SY+qBNI+z54Ua9cKbTxHp3C6J1SEEYDxKQoGOzZ0uTK/H2t4L/QMKm7Njb3W0l64bf+85g3 vu1AXd8G1ioPVW X-QQ-GoodBg: 0 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.11\)) In-Reply-To: <6B9B9796-F66E-45EC-B5CC-58051170F2F2@lvht.net> Date: Sun, 5 Nov 2017 21:04:10 +0800 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <79BC6B21-2A9E-4A2E-9858-33EA4019CA37@lvht.net> References: <736B46E8-9458-4E63-8BB7-AF93A8C35F58@lvht.net> <6B9B9796-F66E-45EC-B5CC-58051170F2F2@lvht.net> To: Dmitry Stogov X-Mailer: Apple Mail (2.3445.5.11) X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:lvht.net:qybgforeign:qybgforeign4 X-QQ-Bgrelay: 1 Subject: Re: [PHP-DEV] RFC - Zend VM Pause API From: i@lvht.net (Haitao Lv) After discussion with Dmitry, I update my RFC. The RFC url is here https://wiki.php.net/rfc/zend-vm-pause-api And I propose to introduce a new interrupt type to make vm = pause-and-return, not pause-and-continue. As mentioned by Dmitry, features like Fiber could be implemented by = current vm_interrupt implementation, theoretically. By using it, even = init a function call will need to make our own op array. So I propose this patch. Thank you. > On 1 Nov 2017, at 17:13, Haitao Lv wrote: >=20 > Would it proper to introduce the following path? >=20 > diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h > index 9bed9f86bb..cf0935df74 100644 > --- a/Zend/zend_vm_def.h > +++ b/Zend/zend_vm_def.h > @@ -8920,13 +8920,19 @@ ZEND_VM_DEFINE_OP(137, ZEND_OP_DATA); >=20 > ZEND_VM_HELPER(zend_interrupt_helper, ANY, ANY) > { > + int8_t interrupt_type =3D EG(vm_interrupt); > + > EG(vm_interrupt) =3D 0; > if (EG(timed_out)) { > zend_timeout(0); > } else if (zend_interrupt_function) { > SAVE_OPLINE(); > zend_interrupt_function(execute_data); > - ZEND_VM_ENTER(); > + if (interrupt_type =3D=3D 2) { > + ZEND_VM_RETURN(); > + } else { > + ZEND_VM_ENTER(); > + } > } > ZEND_VM_CONTINUE(); > } >=20 >> On 1 Nov 2017, at 16:54, Haitao Lv wrote: >>=20 >> It seems that set EG(vm_interrupt) to 1 could not stop the vm = execution but only execute the interrupt_function and continue the = current execution. >>=20 >> However, my RFC propose to stop the current execution. >>=20 >>> On 1 Nov 2017, at 16:07, Dmitry Stogov wrote: >>>=20 >>> Hi, >>>=20 >>> It should be possible do similar things using EG(vm_interrupt) and = zend_interrupt_function() callback (introduced in php-7.1) >>> ext/pcntl implements asynchronous signal handling using this. >>>=20 >>> Thanks. Dmitry. >>> From: Haitao Lv >>> Sent: Wednesday, November 1, 2017 4:19:07 AM >>> To: PHP Internals >>> Subject: [PHP-DEV] RFC - Zend VM Pause API=20 >>>=20 >>> Hi, internals, >>>=20 >>> I propose to introduce a new zend vm pause api, and here is the RPF >>>=20 >>> https://wiki.php.net/rfc/zend-vm-pause-api = >>>=20 >>> Please gave your comment. >>>=20 >>> Thank you. >>>=20 >>>=20 >>>=20 >>> --=20 >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php = >=20 >=20 >=20 >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php