[PHP-DEV] [VOTE] Fiber API

2018-06-10 Thread Haitao Lv
Hello Internals, The RFC for fiber is now open for a vote. The RFC is available at https://wiki.php.net/rfc/fiber. Voting will be open until June 22th, 2018. Thank you. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Fiber support (again)

2018-02-10 Thread Haitao Lv
Hi, all, I have updated the RFC https://wiki.php.net/rfc/fiber changes list: - introduce the `throw(Exception $exceptin)` API - record issues discussed > On Feb 9, 2018, at 08:12, Haitao Lv wrote: > >> >> On Feb 9, 2018, at 06:22, Niklas Keller wrote: >> >>

Re: [PHP-DEV] [RFC] Fiber support (again)

2018-02-08 Thread Haitao Lv
> On Feb 9, 2018, at 06:22, Niklas Keller wrote: > >> >>> - How do you determine when a fiber has returned? Looking at the source, >> it appears Fiber::status() must be used, comparing against constants. >> Separate methods similar to Generator would be better IMO. e.g.: >> Fiber::alive(), Fib

Re: [PHP-DEV] [RFC] Fiber support (again)

2018-02-08 Thread Haitao Lv
> On Feb 8, 2018, at 12:18, Aaron Piotrowski wrote: > >> >> On Feb 7, 2018, at 7:05 PM, Haitao Lv wrote: >> >> Hi internals, >> >> I propose to introduce the Fiber feature AGAIN. >> >> The main purpose of the RFC is to introducing a

[PHP-DEV] [RFC] Fiber support (again)

2018-02-07 Thread Haitao Lv
PHP 7.3 release. Please see the RFC https://wiki.php.net/rfc/fiber Dmitry and I are working on the implementation at https://github.com/fiberphp/fiber-ext And a series of usage demo can be found at https://github.com/fiberphp/fiber-demo Please offer you comments. Thank you. --- Haitao Lv

[PHP-DEV] The master branch breaks the ZEND_USER_OPCODE

2018-01-09 Thread Haitao Lv
/8. in on line 0 Could any one offer some help? Thank you. Haitao Lv -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC - Zend VM Pause API

2017-11-05 Thread Haitao Lv
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: > > Would it proper to introduce the following path? > > diff --git a/Zend/zend_

Re: [PHP-DEV] RFC - Zend VM Pause API

2017-11-01 Thread Haitao Lv
To make the discussion more detailed, please allow me to offer my implementation of use land coroutine(Fiber). https://github.com/php/php-src/compare/master...fiberphp:fiber-ext?expand=1 > On 1 Nov 2017, at 17:32, Haitao Lv wrote: > > Suppose we have a internal Coroutine class and

Re: [PHP-DEV] RFC - Zend VM Pause API

2017-11-01 Thread Haitao Lv
ote: > > after zend_interrupt_function() callback VM continues execution using > EG(current_execute_data). > callback may modify it in any way (e.g. unwind stack, or switch to another > co-routine or continuation). > > Thanks. Dmitry. > From: Haitao Lv > Sent: Wednes

Re: [PHP-DEV] RFC - Zend VM Pause API

2017-11-01 Thread Haitao Lv
); - ZEND_VM_ENTER(); + if (interrupt_type == 2) { + ZEND_VM_RETURN(); + } else { + ZEND_VM_ENTER(); + } } ZEND_VM_CONTINUE(); } > On 1 Nov 2017, at 16:54, Haitao Lv wrote: > > It seems th

Re: [PHP-DEV] RFC - Zend VM Pause API

2017-11-01 Thread Haitao Lv
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. > > Thanks. Dmitry. > From: Haitao Lv > Sent: Wednesday, November 1, 2017 4:19:07 AM > To: PH

[PHP-DEV] RFC - Zend VM Pause API

2017-10-31 Thread Haitao Lv
Hi, internals, I propose to introduce a new zend vm pause api, and here is the RPF https://wiki.php.net/rfc/zend-vm-pause-api Please gave your comment. Thank you. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] Wiki karma request

2017-09-10 Thread Haitao Lv
Username: lvht Access requested: Wiki create Reason: Create RFC for feature of Fiber (sackful coroutine) support. Thanks. Haitao Lv -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] add Fiber (sackful coroutine) support

2017-09-09 Thread Haitao Lv
> On 9 Sep 2017, at 14:27, Haitao Lv wrote: > >> I note that the examples there all implement it not as a keyword, but as a >> library function, which maybe makes more sense: whereas "yield" turns a >> function declaration into a generator declaration, &quo

Re: [PHP-DEV] Don't add simple objects to GC's roots

2017-09-09 Thread Haitao Lv
> On 30 Jul 2017, at 18:19, Andreas Treichel wrote: > > Hi, > >> So I propose to make the gc_disable function accept one zval reference as >> parameter. And if gc_disable get that zval, gc_disable just drop the zval’s >> GC_COLLECTABLE flag, which will hint the PHP gc not to trace that zval. >

Re: [PHP-DEV] add Fiber (sackful coroutine) support

2017-09-08 Thread Haitao Lv
> On 2 Sep 2017, at 20:19, Rowan Collins wrote: > > On 1 September 2017 14:02:29 BST, Haitao Lv wrote: >> >> Fiber is a lightweight thread. Please see >> https://en.wikipedia.org/wiki/Fiber_(computer_science) >> And ruby support Fiber. Please see >> htt

Re: [PHP-DEV] add Fiber (sackful coroutine) support

2017-09-08 Thread Haitao Lv
> On 1 Sep 2017, at 22:25, Niklas Keller wrote: > > A potential way around that (might be a stupid idea I just had): Allow > defining "wrappers" per file, that auto-wrap marked functions. Amp need these wrapper functions because we cannot yield a generator from its sub function call. So if we i

Re: [PHP-DEV] add Fiber (sackful coroutine) support

2017-09-01 Thread Haitao Lv
> On 1 Sep 2017, at 20:45, Rowan Collins wrote: > > Is this your own invention, or is the name and semantics based on some > existing language or computer science theory? "Fiber" makes me think of > strings, rather than coroutines, so maybe I'm missing a key metaphor here. Fiber is a lightwei

[PHP-DEV] add Fiber (sackful coroutine) support

2017-08-31 Thread Haitao Lv
Hi, All, The generator has been introduced in PHP 5.5. And we can it pause a function execution. With these feature, we can schedule multi io task in userland without blocking. More details can be found at [Nikic]. And there is also some asynchronous frameworks like [AMP], which allow programe

Re: [PHP-DEV] Don't add simple objects to GC's roots

2017-07-29 Thread Haitao Lv
Hi, internals, > On 26 Jul 2017, at 22:57, Nicolas Grekas wrote: > > I'm hitting more and more the GC threshold in projects I work on (the "10k > roots" one), leading to high CPU usage. Usually, the GC finds nothing to > clean, so this is just a waste of CPU. More and more php frameworks use ob