Skip to content

add stackfull coroutine(Fiber) support - #2723

Closed
taoso wants to merge 6 commits into
PHP-7.2from
unknown repository
Closed

taoso wants to merge 6 commits into
PHP-7.2from
unknown repository

Conversation

@taoso

@taoso taoso commented Aug 31, 2017

Copy link
Copy Markdown

Make this PR for comment.

@KalleZ

KalleZ commented Aug 31, 2017

Copy link
Copy Markdown
Member

I'm a little concerned on this at that it adds a new keyword but it doesn't have any tests at all

@taoso

taoso commented Aug 31, 2017

Copy link
Copy Markdown
Author

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.

@KalleZ

KalleZ commented Aug 31, 2017

Copy link
Copy Markdown
Member

@lvht thanks! I will have a look once more updates come :)

@KalleZ

KalleZ commented Aug 31, 2017

Copy link
Copy Markdown
Member

Ps. remember to update ext/tokenizer (and tests) whenever

@taoso

taoso commented Aug 31, 2017 •

Copy link
Copy Markdown
Author

hello @KalleZ , I have made some basic test to demonstrate the fiber api. And the tokenizer has been updated as well.

@nikic

nikic commented Sep 1, 2017

Copy link
Copy Markdown
Member

What happens if there are internal calls on the call stack? Say something like array_map(function() { await; }, [1, 2, 3]); inside a fiber. Internal calls (using the C stack rather than the VM stack) are usually the problem with this kind of endeavor.

@laruence

laruence commented Sep 1, 2017

Copy link
Copy Markdown
Member

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

@taoso

taoso commented Sep 1, 2017 •

Copy link
Copy Markdown
Author

@nikic It is a big shot to me. And it seems that we cannot restore/resume the stack in zend engine.
Is it proper to throw an exception when await is used in the internal call?

@taoso

taoso commented Sep 1, 2017

Copy link
Copy Markdown
Author

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?

@laruence

laruence commented Sep 1, 2017

Copy link
Copy Markdown
Member

@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 ..

@taoso taoso mentioned this pull request Sep 2, 2017
@taoso taoso closed this Sep 2, 2017
@taoso

taoso commented Sep 2, 2017

Copy link
Copy Markdown
Author

please see #2733

@taoso taoso mentioned this pull request Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants