Add Closure::fromCallable().#1906
Merged
php-pulls merged 4 commits intophp:masterfrom Jul 5, 2016
Danack:closurefromcallable
Merged
Add Closure::fromCallable().#1906php-pulls merged 4 commits intophp:masterfrom Danack:closurefromcallable
php-pulls merged 4 commits intophp:masterfrom
Danack:closurefromcallable
Conversation
Add the ability to create closures from callable as part of RFC: https://wiki.php.net/rfc/closurefromcallable
Zend/zend_closures.c
Outdated
|
|
||
|
|
||
| /* {{{ proto Closure Closure::fromCallable(callable callable) | ||
| Create a closure from a callabl using the current scope. */ |
| memset(&call, 0, sizeof(zend_internal_function)); | ||
|
|
||
| call.type = ZEND_INTERNAL_FUNCTION; | ||
| call.handler = zend_closure_call_magic; |
Member
There was a problem hiding this comment.
Call through zend_call_function() is more expensive than through TRAMPOLINE.
Why it's not possible to reuse the same trampoline?
May be it makes sense to move trampoline function into zend_closure and free it together with closure object...
Contributor
Author
There was a problem hiding this comment.
Dmitry - I don't really understand trampolines. So long as this PR is acceptable and the tests all pass, is it okay for you to do any performance improvements you think are good, after this PR is accepted and closed?
Member
There was a problem hiding this comment.
Yeah. Commit this. I'll take a look, if it's possible to optimise this using trampolines later.
| @@ -0,0 +1,48 @@ | |||
| --TEST-- | |||
| Imagick::readImage test | |||
Member
|
Can someone tag this with RFC and accepted, it is destined for 7.1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the ability to create closures from callable as part of RFC: https://wiki.php.net/rfc/closurefromcallable