-
Notifications
You must be signed in to change notification settings - Fork 7.9k
add stackfull coroutine(Fiber) support #2723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'm a little concerned on this at that it adds a new keyword but it doesn't have any tests at all |
Hello @KalleZ , thanks for commenting. This is PR is now a prototype and for comment only. I had send a discuss email to the internal list. If this feature will be accepted, I will add tests. |
@lvht thanks! I will have a look once more updates come :) |
Ps. remember to update ext/tokenizer (and tests) whenever |
hello @KalleZ , I have made some basic test to demonstrate the fiber api. And the tokenizer has been updated as well. |
What happens if there are internal calls on the call stack? Say something like |
First this PR should against master branch as it include so many changes, especially lots changes in zend VM. Second, all changes to VM seems only relates to AWAIT, that make me think, maybe this feature could exists as an class lay in ext/spl, or even an PECL extension? you only need change await to Fiber::await(), right? and in that case, this feature will be self-contain, and more robust to me. thanks |
@nikic It is a big shot to me. And it seems that we cannot restore/resume the stack in zend engine. |
Hello @laruence , I want to make the Fiber as a pecl extension. But is there any approach to pause the zend engine without introducing a new opcode? |
@lvht in theory, I think yes, you could use longjmp, save context(zend_execute_data), then restore it when doing resume... anyway, I haven't verify it .. |
please see #2733 |
Make this PR for comment.